[android-developers] Re: Singletons in Android .... Final solution?
You are right that the enum has been initialized a second time.
But the second time is a different process (26202 != 26607).
In other words, the first process (26202) did not see this enum being initialized twice. The process was killed and the new process had its enum initialized instead.
About the intent re-delivery : This is per design of Android, so that you can save data that survives killing and restarting of your activities' processes. This is handled by the OS, not by your app's process.
On Thursday, May 3, 2012 7:03:16 PM UTC-4, blake wrote:
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
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home