They changed this behavior somewhere along the line -- I forget
exactly when. It used to work as documented, and now behaves as Kostya
indicated.

On Sun, Sep 19, 2010 at 3:06 PM, Chris <[email protected]> wrote:
> Thank you very much for the reply, I was afraid that might be your
> answer!  If it is the case, and the onUpdate method is always called
> before the configuration activity is launched, then the Android
> documentation is wrong:
>
> From the documentation(http://developer.android.com/guide/topics/
> appwidgets/index.html):
>
> The onUpdate() method will not be called when the App Widget is
> created (the system will not send the ACTION_APPWIDGET_UPDATE
> broadcast when a configuration Activity is launched). It is the
> responsibility of the configuration Activity to request an update from
> the AppWidgetManager when the App Widget is first created. However,
> onUpdate() will be called for subsequent updates—it is only skipped
> the first time.
>
> On Sep 19, 2:50 am, Kostya Vasilyev <[email protected]> wrote:
>>   19.09.2010 6:08, Chris пишет:>    I'm having an issue with a config 
>> activity for a widget.  According
>> > to the dev docs, if I specify a configuration activity than the
>> > onUpdate method of the AppWidgetProvider doesn't get called until
>> > after you request an update once you've completed the configuration
>> > activity.  For me its happening in reverse, the onUpdate method of the
>> > AppWidgetProvider gets called first, followed by the configuration
>> > activity.  Then the onUpdate method is never called after completion
>> > of the config activity even though I request it explicitly.  I tried
>> > with level 4 and level 7 API, same result.  Here is some of the
>> > source:
>>
>> onUpdate getting called before the config activity is done is normal
>> (i.e. Android does things this way, not sure it's a good thing, but it's
>> not something specific to your code), the widget is hidden at this point.
>>
>> Not sure what you mean by "requesting" an update - what config activity
>> is supposed to do is build a RemoteViews object and push it "manually"
>> to the widget using appWidgetManager.updateAppWidget(<widget id>,
>> <remote views>);
>>
>> Using a config activity can result in some issues with stale widget ids
>> (if the user cancels). I've documented my experiences with it here:
>>
>> http://kmansoft.wordpress.com/2010/06/22/per-widget-options-stale-wid...
>>
>> --
>> Kostya Vasilyev -- WiFi Manager + pretty widget 
>> --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
>



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

_The Busy Coder's Guide to Android Development_ Version 3.1 Available!

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

Reply via email to