On Mon, Mar 28, 2011 at 9:59 AM, Jake Colman <[email protected]> wrote:
>>>>>> "MM" == Mark Murphy <[email protected]> writes:
>
>   >> ... I'd further qualify that as "... a cached Context (if needed) should 
> be
>   >> an Application object reference, rather than a local, short-lived 
> Context".
>
> Does extending the Application class to save the context and providing a
> static method to access that context an appropriate solution as well?

No. Application *is* a Context. There is no other type of Context that
has the Application's lifetime. Do not cache non-Application Contexts
in process-lifetime places (static data members or Application), or
you will have to contend with memory leaks.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in NYC: http://marakana.com/training/android/

-- 
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

Reply via email to