Consider extending the Application class and using that to store
objects which are required throughout activities. As Dianne said, you
are less likely to leak a context if you use that.

On Oct 11, 9:58 pm, Dimitris <[email protected]> wrote:
> Agreed. For UI related cases that you might want to use that Context,
> the application one is not suited.
>
> Use depending on what you are trying to do :)
>
> On Oct 11, 11:13 am, Mark Murphy <[email protected]> wrote:
>
> > On Mon, Oct 11, 2010 at 2:01 PM, Dimitris <[email protected]> wrote:
> > > The context class is abstract. When you say context do you mean an
> > > Activity context? I suggest you look at the Application class (see
> > > getApplicationContext()) and pass that instead. It is much much safer
> > > from memory leaks rather than passing the Activity around.
>
> > Bear in mind, though, that the Context returned by
> > getApplicationContext() is not going to be suitable in all cases. I
> > and others have run into problems with this related to UI operations.
>
> > --
> > Mark Murphy (a Commons 
> > Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> > Android Training...At Your Office:http://commonsware.com/training

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