I've already tried that, it doesn't.

And to answer my question:

1 - There is a new Intent flag in API 11, FLAG_ACTIVITY_CLEAR_TASK, which
does just what I need, clears the existing task before launching the
activity as its root. Too bad I can't use that.

2 - Again in API 11, there is a whole new way of launching the application
into the middle of its activity stack with PendingIntent, specifically built
for use with widgets and status bar notifications.

This is actually my case: the reason B ever exists all by itself in the task
stack is because it was launched from a widget / status bar, and I'd prefer
to launch A and B both in this case.

-- Kostya
2011/6/17 Yong Ma <[email protected]>

>
> Set B's finishOnTaskLaunch true. It may help you.
>
> On Jun 17, 2:23 am, Kostya Vasilyev <[email protected]> wrote:
> > Does anyone know if there is a way to start a new activity into an
> existing
> > task, so it becomes the new task root if it doesn't already exist within
> the
> > task?
> >
> > It might look like this:
> >
> > Let's say, the package has two activities, A (which is a LAUNCHER / MAIN)
> > and B (which is not).
> >
> > Now at some point, the task stack has either A, and B on top of it, or
> just
> > B all by itself.
> >
> > I'd like to launch A from outside the task (a status bar notification,
> etc.)
> > so that:
> >
> > - If A already exists with the task (A -> B), I'd like B to be finished.
> >
> > Settting FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TOP or
> > clearTaskOnLaunch does this quite nicely.
> >
> > - If the task only has B, I'd like B to also be finished, and A to become
> > the new task root.
> >
> > I'm having trouble finding anything that would let me implement this
> second
> > case.
> >
> > It seems to me that clearTaskOnLaunch for A in the manifest should do
> this,
> > but it doesn't: B stays within the task as its root, and A is launched on
> > top of it.
> >
> > Am I missing something and it can be done, or is this really not possible
> > with just something in the manifest / intent flags?
> >
> > Thanks,
> > -- Kostya
>
> --
> 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

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