Re:: [android-developers] Re: Singletons in Android .... Final solution?
Same thread in a different process?
Is that some kind of metaphor I'm not able to understand?
As far as "a field becoming uninitialized" - you haven't shown that, only your lack of understanding of Android fundamentals, and an irrational desire to insist on it.
04.05.2012 3:24 пользователь "blake" <blake.meike@gmail.com> написал:
-- On May 3, 4:15 pm, Streets Of Boston <flyingdutc...@gmail.com> wrote:
> You are right that the enum has been initialized a second time.
> But the second time is a different process (26202 != 26607).
I know! I know! Different process, different class loaders,
(...oddly, might be the same thread)
> 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.
The point of this whole thread, I believe, is that it is not safe to
put stuff in to static fields of the application. They will not be
there when you get back. Among the things that it is not safe to do,
is to "initialize" the static field with some value and then assume
that the field will continue to have that value. From the point of
view of your application/task the field has become uninitialized.
I completely agree that this might not be a bug. It is outright
documented to happen in an Activity. It is a little surprising, in
the activity, though...
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