>>>>> "KV" == Kostya Vasilyev <kmans...@gmail.com> writes:

   KV> 3 - Each RemoteViews update needs to be self-sufficient, that is,
   KV> contain all the data items (setTextViewText, etc.) as well as
   KV> PendingIntent's.

   KV> Do not push separate, incremental, RemoteViews: one for text
   KV> views, then another for pending intents, etc. If you do, your
   KV> widget will stop working after a home screen orientation change
   KV> or if the Launcher is kicked out of memory.

   KV> http://kmansoft.wordpress.com/2010/05/23/widgets-and-orientation-changes/

   KV> The lifetime of widget receiver does not matter here. The
   KV> contents of RemoteViews is saved by the launcher, and
   KV> PenidingIntent's are saved by "the system".

   KV> Finally, do not ignore onUpdate. The launcher may have its
   KV> reasons to rebuild the widgets, such as when the user changes the
   KV> phone's UI language, and maybe in other cases as well.

So it *is* correct always set up the onClickPendingIntent every time I
build and push update.  I thought maybe I had missed something and was
making a colossal error.

I guess I will recode my onReceive() to actually do its work by invoking
onUpdate().  This way it all works even if the system invokes onUpdate()
on its own.

Thanks again, Kostya, for your excellent help.

This widget of mine started out as a learning exercise (I have many
years of C/C++ experience but almost none with Java and none at all with
Android) but one that solved a real problem.  I posted the widget
thinking that others might find it useful too.  I now have close to 400
active users (as measured by Flurry via a once daily broadcast) and keep
getting requests for enhancements.  Without the help of people such as
yourself (and Mark Murphy, Treking, and a few others) I never would have
made it this far.  Thanks!

-- 
Jake Colman -- Android Tinkerer

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