Sorry. I meant to say remote views like in the subject ;-)

I currently update the remote views to which I kept a reference and then
notify again with the same Id.
That seems to work, but I would like to know if this is the right way to do
it.

Written on a mobile device

On Mar 21, 2010 12:58 PM, "Mark Murphy" <[email protected]> wrote:

Mariano Kamp wrote:
> when using the new Service.startForeground() method how do you do
> updates to...
Those two concepts are not strictly tied, AFAIK. A Service would update
the app widget the same way regardless of whether or not it called
startForeground().

BTW, I don't know what a "remote widget" is. I am just assuming you are
referring to home screen "app widgets".

To update an app widget, a Service gets an AppWidgetManager and RemoteViews:

ComponentName me=new ComponentName(this, AppWidget.class);
RemoteViews updateViews=new RemoteViews("apt.tutorial",
                                       R.layout.widget);
AppWidgetManager mgr=AppWidgetManager.getInstance(this);

then populates the RemoteViews and has the manager post those changes to
the home screen via mgr.updateAppWidget(me, updateViews).

You can see this used here:

http://github.com/commonsguy/cw-andtutorials/tree/master/36-AdvAppWidget/

--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Android App Developer Training: http://commonsware.com/training

--
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]<android-developers%[email protected]>
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

To unsubscribe from this group, send email to android-developers+
unsubscribegooglegroups.com or reply to this email with the words "REMOVE
ME" as the subject.

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

To unsubscribe from this group, send email to 
android-developers+unsubscribegooglegroups.com or reply to this email with the 
words "REMOVE ME" as the subject.

Reply via email to