So I could just have some kind of main activity which will

#1 start the background service
#2 then launch other supporting activities

When that main-activity starts the other supporting activities ( Which
could be essentially simple dialogs) those "dialog-activies" could
take it for granted that the background service is running and access
it via a static member in the Application object. And if that static
reference to "the service" is null, the supporting activity will fail
- which would be the exception.





On Jan 30, 12:54 am, Dianne Hackborn <[email protected]> wrote:
> There's nothing wrong with using aidl, I just guide people away from it
> because usually they are unhappy to deal with it and don't need it anyway.
> :)
>
> One thing people often do is make a common base class (or helper class that
> include an instance of) that provides this functionality that is used across
> a variety of activities.  I realize the dealing with the async nature of
> binding to services is annoying, but unfortunately that's the way it is.
>
> Unfortunately I don't know that the local process globals would help a lot
> here -- you still must have each activity bind to the service if it needs it
> to be running.  But if your activity just wants to use the service if it
> happens to already be running, and you can stomache making your components
> have a more carnal relationship, then globals can simplify a lot.
>
> On Thu, Jan 29, 2009 at 8:46 PM, Noonien Soong
> <[email protected]>wrote:
>
>
>
>
>
> > > It's a convenient short-cut.  If you are philosophically opposed to such
> > > things you can go the more formal route and make things harder on
> > yourself.
> > > :)
>
> > hehe, that seems to be the story of my life :-) ... the reluctance to
> > do things the easy way.
>
> > By the way, thanks Dianne for the replies!
>
> > I am using AIDL-defined interfaces right now. I guess I went a little
> > bit too far maybe. Currently I have one service to which I bind from
> > two different activities with plus 1 callback-interface each.
>
> > Now I'm starting to rethink this architecture because I'm adding more
> > and more activities which need to talk to the service running in the
> > background. Having a separate binding for each activity is starting to
> > seem a bit too much..
>
> --
> Dianne Hackborn
> Android framework engineer
> [email protected]
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support.  All such questions should be posted on public
> forums, where I and others can see and answer them.
--~--~---------~--~----~------------~-------~--~----~
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