Mark, et al, Thanks for all the replies. My use of the singleton pattern was correct as was confirmed by these posts. I did find my issues - one of which _was_ due to not handling lifecyle correctly - and now all is well.
...Jake >>>>> "MM" == Mark Murphy <[email protected]> writes: MM> Note that this will only work single-threaded. Add the MM> synchronized keyword to the method and make the static data MM> member volatile to make it safe for multi-threaded access. MM> (a problem I ran into with WakefulIntentService, which is why MM> this issue is fresh in my mind...) MM> On Wed, Jun 1, 2011 at 10:34 PM, Streets Of Boston MM> <[email protected]> wrote: >> 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 MM> -- MM> Mark Murphy (a Commons Guy) MM> http://commonsware.com | http://github.com/commonsguy MM> http://commonsware.com/blog | http://twitter.com/commonsguy MM> Android 3.0 Programming Books: http://commonsware.com/books MM> -- MM> You received this message because you are subscribed to the Google MM> Groups "Android Developers" group. MM> To post to this group, send email to [email protected] MM> To unsubscribe from this group, send email to MM> [email protected] MM> For more options, visit this group at MM> http://groups.google.com/group/android-developers?hl=en -- Jake Colman -- Android Tinkerer -- 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

