The code below will work fine for a singleton:
...
private static MyObject myObject = null;
public static MyObject getMyObject() {
if (myObject == null {
myObject = new MyObject();
}
return myObject;
}
Note that variable won't be 'reset' to null. There is nothing to reset when
your process is killed. It is gone, nohting left.
When a *new* process is started, i.e. the process that will run your app
again, then the static fields are all properly initialized (in this case,
'myObject' to the value 'null').
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en