On Sun, Oct 31, 2010 at 4:39 AM, Kostya Vasilyev <kmans...@gmail.com> wrote:
> Right, a static block runs only once. And is guaranteed to run in this case,
> since Android is going to instantiate MyApplication.
>
> You wrote in the original email that the native side needs to initialize
> some statics and singletons. Those should only be initialized once, so a
> static block works here.

Apparently, Tim's app (combined with the scenario I outlined) does not
deal well with this case. Near as I can interpret matters, his app
gets confused when a new Application object is created yet his statics
are still in the state from the previous Application object.

Part of the problem is that his native code was written for iOS, which
does not recycle processes. If the user plays this game, leaves the
game, and comes back into the game, it's a brand new process with
brand new initialized statics.

Again, I think he can work around that by more closely tracking the
Application object instances themselves. I'm just trying to figure out
if the overlapping-Application condition can really happen.

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

Android 2.2 Programming Books: http://commonsware.com/books

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