skink wrote:
> hi,
> 
> my custom AppWidgetProvider has onUpdate method where i have logic to
> update RemoteViews
> 
> it is not periodically updated by system, but rather, i'd like to
> trigger onUpdate if something happens (in one of my app Activities).
> both custom AppWidgetProvider and Activities i'd like to trigger
> update from run with the same UID
> 
> i tried some AppWidgetManager's methods, but no luck, finally i ended
> with really weird solution: i'm sending broadcast with action
> ACTION_APPWIDGET_UPDATE and extras EXTRA_APPWIDGET_IDS which i got
> from AppWidgetManager
> 
> is it a common way of updating AppWidgetProvider?

You could also just send a broadcast to the provider directly, via the
component-name version of the Intent constructor. Look for a null
action, or some extra you package in, or something to tell it is your
own custom Intent, then do the update work.

For example, I have a Twitter widget that has a refresh button using
this technique:

http://github.com/commonsguy/cw-advandroid/tree/master/AppWidget/TwitterWidget/

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

Android Training in Germany, 18-22 January 2010: http://bignerdranch.com

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to