Ok, I may be a bit vague, but say I want an utility class to do some
common stuff, including resources and shared prefs. Then I need a
context. If I put a SharedPreferenceListener into the class, I am lost
if I want to do something using a context when receiving the
callbacks.

This is how I think about it now: singleton object with init(ctx).
Init is called from App, i.e. with appctx.
What would typically this (app)context not be suitable for?

Sorry for deviating...

/Chuck

On 12 Okt, 21:03, TreKing <[email protected]> wrote:
> On Tue, Oct 12, 2010 at 1:37 PM, Chuck Lega <[email protected]> wrote:
> > For instance, say I register a listener in the singleton. The callbacks to
> > the listener does not contain a context, and I am back at square one
> > again...So, I guess init-ing the singleton with a context is the simplest
> > way,
> > and making it a service the most robust/correct(?).
>
> What listeners and callbacks are we talking about? You may want to provide
> more, um, context (har har) about how you're using a singleton, callbacks,
> listeners, and the Context. There's probably a better way than initializing
> the singleton with the Context object.
>
> And making your singleton a Service may not necessarily be the most robust
> /correct - it depends on what you're trying to achieve with this singleton.
>
> ---------------------------------------------------------------------------­----------------------
> 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