Thursday, June 16, 2011

[android-developers] Re: Is there a launchMode or an Intent flag for this?

Set B's finishOnTaskLaunch true. It may help you.

On Jun 17, 2:23 am, Kostya Vasilyev <kmans...@gmail.com> 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment