Listing 109 Modifying View properties within an App Widget Remote View

// Update a Text View views.setTextViewText(, "Updated Text"); views.setTextColor(, Color.BLUE); // Update an Image View views.setImageViewBitmap(, myBitmap); // Update a Progress Bar views.setProgressBar(, 100, 50, false); // Update a Chronometer views.setChronometer(.id.widget_chronometer, SystemClock.elapsedRealtime(), null, true);

You can also set the visibility of any View hosted within Remote Views by calling setViewVisibility, as shown here:

views.setViewVisibility(, View.VISIBLE);

As described in the previous section, once you've made changes to a Remote Views object you must use the App Widget Manager to apply those changes to a particular widget, as shown here:

appWidgetManager.updateAppWidget(appWidgetId, views);

Was this article helpful?

0 0
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