Re:: [android-developers] Re: Singletons in Android .... Final solution?
The process ids in your two log outputs are different.
Therefore, the second time your application was, once again, created from scratch (more or less), and so was the singleton.
( PS: I find it amazing that this issue repeatedly comes up on the list, and the more time passes, the more complicated and mysterious it appears... )
( PPS: you probably meant list of processes, not threads )
04.05.2012 3:03 пользователь "blake" <blake.meike@gmail.com> написал:
-- Ok, the code is here:
https://github.com/bmeike/MarksPlace
If I run the app on my Nexus S, it logs something like this:
05-03 15:45:14.151: D/####(26202): SINGLETON@1336085114158
If I then run a bunch of other apps -- about a dozen -- I see this app
disappear from the list of active threads. If I then return to it, I
see something like this:
05-03 15:48:33.643: D/####(26607): SINGLETON@1336085313650
The enum has been initialized a second time, just because it was push
into the BG and left there for a while.
btw, this app doesn't demonstrate this fact, but the saved state
bundle is *not* lost.
> onTerminate() is never called on an Application, despite the docs. The
> Application object goes away when the process does.
Yeah! Apparently not! If the documentation were correct, just
*anybody* could be an Android developer! ;)
Blake Meike
Marakana
The second edition of Programming Android is now on line!
http://shop.oreilly.com/product/0636920023005.do
--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home