My root Activity maintains an AIDL connection to a Service. Depending
on operations it receive from the Service, it will issue commands to
children Activities that were spawned in the foreground. When the
entire Activity stack goes into the background, the root Activity must
be able to notify the Service so it can post messages to the
NotificationManager instead of sending them directly to a Task in the
background.

The problem with simpling setting a flag when launching a new activity
is the RootActivity still cannot tell when the entire task get
switched, since onStop() is only called once. Consider the scenario
where the RootActivity spawned a ChildActivity in the foreground. If
the user then switches to another Task, RootActivity still cannot tell
that its current Task is going into the background.

On Aug 5, 10:27 am, TreKing <treking...@gmail.com> wrote:
> On Thu, Aug 5, 2010 at 9:06 AM, Jin Chiu <live2drea...@gmail.com> wrote:
> > I would like to get notified when the user has switched to another
> > application.
>
> Out of curiosity, why?
>
> > In this case, onStop() in MyActivityA does not suffice as that will also
> > get invoked if the user navigates to another screen within my app.
>
> Maybe set a flag indicating that you've launched a new activity yourself, so
> onStop if your flag is set, it was you. If not, the user switched using
> other means. Yes, this is a hack and will probably break in subtle ways.
> Good luck.
>
> --------------------------------------------------------------------------- 
> ----------------------
> 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to