I just stick android:configChanges="keyboardHidden|orientation" in my
manifest. I generally do that by default these days. Haven't come
across any problems so far!

Does that explain why it works?

On May 9, 1:13 pm, Mark Murphy <mmur...@commonsware.com> wrote:
> westmeadboy wrote:
> > 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...
>
> That won't happen on an orientation change, but could easily happen if
> the user is playing with your app and then presses HOME and abandons it
> for a while. Or if they take a phone call and abandon it for a while. Or
> if they get involved in a serious round of TXTing and abandon it for a
> while.
>
> > 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.
>
> Ah, so you're just using it on a transient basis. Interesting. Not sure
> how you're handling rotation, then, in that 2nd activity -- you can't
> let it get destroyed and recreated, because then your static is null'd out.
>
> Statics in Android are one of those "necessary evil" sorts of things.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> Warescription: Three Android Books, Plus Updates, One Low Price!
>
> --
> 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 
> athttp://groups.google.com/group/android-developers?hl=en

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