On Sun, Mar 27, 2011 at 10:58 AM, Kostya Vasilyev <[email protected]>wrote:

> Any Singleton, manager, or utility class can take Context as a parameter
>> for the functions it needs it for, making it clear to the user of the API
>> that a Context is needed for that functionality
>>
>
> Sure, that's another way. I prefer to not do this, but coding style is a
> personal thing.
>

Word. I'm just curious to see if there are more practical reasons to use one
vs the other. In case I've been doing it wrong all along :-)

On Sun, Mar 27, 2011 at 11:17 AM, Mark Murphy <[email protected]>
 wrote:

> > However, there are cases where a true global context is required, and
> > passing a local Context as a parameter causes a leak.
>
> Agreed. That is covered by TreKing's "Use it when you need to store
> a context in an object that lives longer than an instance of an activity or
> service, but don't want to leak that activity or service".


Just give credit where it's due, I was quoting Doug from the original
thread.


Thanks for the examples Mark.

-------------------------------------------------------------------------------------------------
TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
transit tracking app for Android-powered devices

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