First of all, pressing Back to exit the game doesn't necessarily mean
you game really exits. Android keeps Activities around and will only
really destroy it if it needs to.

Secondly: nowhere in your app you are setting mLunarThread to null? If
you are, then potentially that's causing it. Yes this is an open door
but just in case :) If you're not doing that anywhere, then it means
the onSharedPreferenceChanged code gets executed before mLunarThread
is set. To figure out what's going on, I suggest my third tip:

Thirdly: add lots more debug statements. Add it when entering
onSharedPreferenceChanged() and all the if/else parts, so you can
clearly see when it's called. Then also put a debug statement in
(almost) all Activity lifecycle methods: onCreate(), onStart(),
onResume() etc. Also put a log statement right before *any* access to
mLunarThread showing its value. If you're using a PreferenceActivity,
also put in debug statements in its onCreate() and get/set methods.
That way you can follow much better what's going on and see when
mLunarThread changes. Potentially you can set a dynamic breakpoint to
via the debugger, I haven't tried that for regular expressions.

Tip: you might want to use a PreferenceActivity instead for clearer
separation. Or is this not possible in the way your game is setup?


On 29 sep, 09:59, Kakyoin <lgmc...@gmail.com> wrote:
> To point out the problem:
>
> How did mLunarThread object suddenly become "null"  at line 352 of
> GameActivity.java ??

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