I have an application that can be started through the launcher but
also through the browser via a custom URL such as appname://parameters.

The root activity is called ActivityA.  The launchmode for ActivityA
was set to singleTop.

I do the following --
1.  Go to the launcher and click the app icon.
2.  ActivityA is launched.
3.  Click a button in the app that takes us to ActivityB.
4.  Hit the HOME key to put our task in the background.

Now we go to a website that launches a url that is handled by our
application through an intent-filter, e.g. appname://parameters
1.  This seems to launch ActivityA as intended but under the same task
as the browser.
2.  Launch ActivityB
Result is that we have two different tasks with the same app.

Task 1
-----------
ActivityB
ActivityA


Task 2
-----------
ActivityB
ActivityA
Browser

Of course this behavior is not desired. That is the imperative for
using singleTask, since another application launches ActivityA.

In this case on launching from the browser, ActivityA comes to the
forefront within Task1 and ActivityB is killed.  This is the desired
behavior.

However, launching again from the launcher also seems to clear Task 1.

For example,

1.  Go to the launcher and click the app icon.
2.  ActivityA is launched.
3.  Click a button in the app that takes us to ActivityB.
4.  Hit the HOME key to put our task in the background.
5.  From the launcher click the app icon again.

ActivityB will be killed and ActivityA will come to the foreground.
How do you prevent this behavior?  Originally, Intent.Action.MAIN was
used to launch ActivityA and I dont want the entire stack to be
cleared when I click the same icon again thus relaunching
Intent.Action.MAIN.

How do I prevent this?

Thanks!

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