Listing 106 A standard pattern for updating Widget UI Available for

download on final int N = appWidgetIds.length;

Wrox.com // Iterate through each widget, creating a RemoteViews object and // applying the modified RemoteViews to each widget, for (int i = 0; i < N; i++) {

int appWidgetId = appWidgetIds[i]; // Create a Remove View

RemoteViews views = new RemoteViews(context.getPackageName(),

R.layout.my_widget_layout);

// TODO Update the widget UI using the views object.

// Notify the App Widget Manager to update the widget using // the modified remote view.

appWidgetManager.updateAppWidget(appWidgetId, views);

Mobile Apps Made Easy

Mobile Apps Made Easy

Quick start guide to skyrocket your offline and online business success with mobile apps. If you know anything about mobile devices, you’ve probably heard that famous phrase coined by one of the mobile device’s most prolific creators proclaiming that there’s an app for pretty much everything.

Get My Free Training Guide


Post a comment