On May 9, 12:52 pm, Mark Murphy <[email protected]> wrote:
> Actually, that's one of the minuses, IMHO.
>
> A static data member survives the rotation. The service, however, will
> shut down mid-rotation if there are no other bound connections to it.
> Right now, you have to manage the orientation change yourself and avoid
> destroying the activity.

I remember using statics before and then (through analytics) finding
that those statics were sometimes null unexpectedly. I came to the
conclusion that this was something to do with the system killing
processes and automatically restarting them (and whatever activity)
passing the same intent data etc. So the activity attempts to start as
before but doesn't have the static set as in the normal scenario. This
is all very hazy but that's my impression...

> However, the problem with the static data member is figuring out when it
> is safe to null out the static reference (for GC purposes) and who's
> supposed to do it.

During onCreate() I copy the static reference to an instance variable
and immediately null the static reference. If the static reference is
initially null then I just disable a couple of buttons that rely on
that cursor being non-null.

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