[android-developers] Re: Singletons in Android .... Final solution?
Romain,
I have have the following code
public class SandboxApplication extends Application {
public static enum Romain {
SINGLETON;
private final long now = System .currentTimeMillis();
@Override public String toString() { return super.toString() +
"@" + now; }
}
@Override public void onCreate() {
super.onCreate();
Log.d("####", Romain.SINGLETON.toString());
}
I am quite certain that I have seen this application log different
times, from that log statement, over the life of the application.
Oddly, I'm fairly certain that I've seen it log different times even
*without* an intervening call to onTerminate.
I'm not claiming this is a bug, at all. It does appear to mean,
though, that you can't reliably squirrel stuff away in the application
object and expect it to be there when you come back.
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