[android-developers] Re: Application-wide resources.. how to achieve?

2010-09-18 Thread Indicator Veritatis
Dianne Hackborn just did a post recently recommending not to use Application unless you really, REALLY need to. (My words, not hers). What criteria she had for "really, really need to" were less clear to me, but I think it was that the data really need to be global (to the application), and do not

[android-developers] Re: Application-wide resources.. how to achieve?

2010-09-17 Thread joebowbeer
Your singleton's lifetime is that of the process (via its class loader), but a process can be reused, right? That is, can't the same process may be reused for subsequent instances of an application? On Sep 17, 9:28 am, Dianne Hackborn wrote: > A little other perspective: > > First, there is no ne

[android-developers] Re: Application-wide resources.. how to achieve?

2010-09-17 Thread Jason
Thanks Dianne, The reference count approach actually makes a lot of sense (hmmm... Objective-C anyone?).. I'm somewhat amazed I didn't think of that, however is it possible that the onDestroy method of the "incubator" Activity will execute before the onCreate of the "offspring" Activity has comple

Re: [android-developers] Re: Application-wide resources.. how to achieve?

2010-09-17 Thread Dianne Hackborn
A little other perspective: First, there is no need to use Application except in cases where you need a global Context. I generally prefer to have shared resources simply placed in singletons in my process, which anyone can directly access: public class SharedStuff { private static final Obj

[android-developers] Re: Application-wide resources.. how to achieve?

2010-09-17 Thread Jason
ok great. Sounds like the ticket. Thanks for your help. On Sep 18, 1:39 am, Bret Foreman wrote: > By the way, the Android-centric name for the pattern you want is > "Content Provider". You can search the documentation for that phrase. > SQLite is an example of a content provider where you norma

[android-developers] Re: Application-wide resources.. how to achieve?

2010-09-17 Thread Bret Foreman
By the way, the Android-centric name for the pattern you want is "Content Provider". You can search the documentation for that phrase. SQLite is an example of a content provider where you normally create an Adapter that wraps around the raw SQLite API to present an application-specific API to the r

[android-developers] Re: Application-wide resources.. how to achieve?

2010-09-17 Thread Jason
lol.. RTFM Jason. Thanks man. On Sep 18, 1:12 am, TreKing wrote: > On Fri, Sep 17, 2010 at 10:07 AM, Jason wrote: > > Is it possible to have data bound to the lifecycle of the entire > > application? > > http://developer.android.com/reference/android/app/Application.html > > ---