I have a widget and when it is pressed it runs a service. the code is below. 
How can i change the image/icon of the widget when it is pressed (not just 
while it is pressed until the next time it is pressed again). Any help would 
be great. thanks.

public void onUpdate(Context context, AppWidgetManager appWidgetManager, 
int[] appWidgetIds) {
        final int N = appWidgetIds.length;
        globalCon=context;
        // Perform this loop procedure for each App Widget that belongs to 
this provider
        for (int i=0; i<N; i++) {
            int appWidgetId = appWidgetIds[i];
            Log.i(TAG,"Widget onUpdated");
            // Create an Intent to launch ExampleActivity
            Intent intent = new Intent(context, 
SignalSpotWidgetService.class);
            PendingIntent pendingIntent = PendingIntent.getService(context, 
0, intent, 0);

            // Get the layout for the App Widget and attach an on-click 
listener to the button
            RemoteViews views = new RemoteViews(context.getPackageName(), 
R.layout.widget_layout);
            views.setOnClickPendingIntent(R.id.widgetButton, pendingIntent);
          
            // Tell the AppWidgetManager to perform an update on the current 
App Widget
            appWidgetManager.updateAppWidget(appWidgetId, views);
    }
}

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to