Hi Sean
Thanks for that.
I had the ComponentName version of the updateAppWidget() method.
I now do this and the individual widgets update correctly:
// Build the widget update for today
RemoteViews remoteViews = buildUpdate(this, webServiceURL,
webServiceTemplate);
// Push update for this widget to the home screen
AppWidgetManager appWidgetManager = AppWidgetManager.getInstance
(this);
appWidgetManager.updateAppWidget(appWidgetId, remoteViews);
Regards
Lyndon
On Jan 14, 12:20 pm, Sean Hodges <[email protected]> wrote:
> On Thu, Jan 14, 2010 at 11:44 AM, Lyndon <[email protected]> wrote:
> > So, my question is 'How do you handle multiple instances of the same
> > widget."
>
> > I know about appWidgetId and the array of appWidgetIds that gets
> > passed about but the problem seems to be that all my instances write
> > to a resource called:
>
> > For example in the Service that does the http request and xml parsing
> > I do this to update the widget:
>
> > updateViews = new RemoteViews(context.getPackageName(),
> > R.layout.widget_message);
> > updateViews.setTextViewText(R.id.message, result);
>
> > There is no refence to appWidgetId here so do all widgets of the same
> > class get updated?
>
> The views you are changing are not associated with any appwidget until
> you call appWidgetManager.updateAppWidget() (which I assume you are
> doing later on in your code). If you pass in the appWidgetId to this
> call, you should be updating only that instance.
>
> Something like this:
>
> AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
>
> updateViews = new RemoteViews(context.getPackageName(),
> R.layout.widget_message);
> updateViews.setTextViewText(R.id.message, result);
>
> appWidgetManager.updateAppWidget(appWidgetId, updateViews);- Hide quoted text
> -
>
> - Show quoted text -
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en