Keeping the same RemoteViews object and repeatedly adding more
operations will cause the copy in your process to get bigger and bigger,
and the actual updates in the launcher process to get slower and slower
over time.
The basic pattern is really simple:
rv = new RemoteViews (....)
rv.setSomethingOrOther(....)
if (needStatusMessage) {
rv.setTextViewText(..., "Loading 100TB, 0.00000001% complete...");
}
else {
rv.setViewVisibility(..., View.GONE);
}
appWidgetManager.updateAppWidget(...., rv)
On the other hand, if you just want to reuse the remote views object
once, that's probably fine. But I don't think it's really worth the
risk of accidentally breaking something.
-- Kostya
20.05.2011 20:32, Niall ?????:
And I have a method that updates the status message like so:
void updateStatusMessage( String str ) {
RemoteViews remoteViews = null;
if ( lastRemoteViews == null )
remoteViews = remoteViewsWithIntents( context );
else
remoteViews = lastRemoteViews;
remoteViews.setTextViewText( R.id.textview_status, str );
refreshWidgetViews( context, remoteViews );
}
Is this good practise? Or should I make a means of specialising the
updateAppWidgetFunction to update the status message only?
--
Kostya Vasilyev -- http://kmansoft.wordpress.com
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en