Questions tagged [launchmode]
176 questions
37
votes
3 answers
About android launchmode "singleTask"
I read the android developer guide and some articles in internet, I'm still confusing about the singleTask launchmode. Lets take an example:
User launch the App1, android starts a new task. Assume the App1 creates activities in follow…

cn1h
- 1,188
- 4
- 16
- 24
16
votes
4 answers
How should I define launchMode in AndroidManifest.xml - Using PhoneGap & JQM
I am struggling to restrict my application to a single instance. Currently if the user presses home screen to quit the application, then does something outside and clicks on the application's icon again, it launches the App's second instance.
Here…

AnR
- 1,809
- 3
- 26
- 45
15
votes
1 answer
SINGLE_TOP | CLEAR_TOP seem to work 95% of the time. Why the 5%?
I have a nearly-finished application with a non-trivial activity structure. There are push notifications associated with this app, and selecting the notification entry is supposed to bring up a specific activity regardless of whether the app is…

Cephron
- 1,577
- 1
- 19
- 26
15
votes
1 answer
SingleTask activity, but opened through two different applications
This image was quite helpful for understanding the
functionality offered by the launhmode singleTask, taken from here
however, I understood this in case of the same application, I am having issues understanding
what if both tasks belong to two…

nobalG
- 4,544
- 3
- 34
- 72
10
votes
1 answer
android 4.4.X: taskAffinity & launchmode vs. Activity lifecycle
I developed a simple application, which demostrates some strange behaviour on Android 4.4.X devices I noticed.
Lets say I want to have 2 "main" activities, where the first says "Hello" (by starting 'HelloActivity') every second time it is resumed…

Berťák
- 7,143
- 2
- 29
- 38
9
votes
3 answers
Android activity launch mode and deeplink issue
My app has 2 activities.
The root activity of the app is the MainActivity. If credentials are missing or invalid the user will be redirected to the LoginActivity while finishing the MainActivity.
If i set the launch mode of the main activity to…

GuyZ
- 686
- 1
- 10
- 25
8
votes
4 answers
Why is launcher activity with launchMode="singleTask" always pushed to top of backstack even if another activity was on top?
My launcher activity has the launchMode attribute set to singleTask due to certain requirements.

vepzfe
- 4,217
- 5
- 26
- 46
8
votes
3 answers
Keep only one instance of each activity in entire app
I want to keep a single instance of every Activity I start in my application. The launchMode singleTask was an option but it is working for only one Activity.
I want
to start an Activity if there is no instance and it is called.
and if any other…

Sagar Nayak
- 2,138
- 2
- 19
- 52
8
votes
1 answer
Android task and process, SingleTask and SingleInstance
I have read through Google Android Developer page, but the concept of task (http://developer.android.com/guide/components/tasks-and-back-stack.html) really confuse me.
After I read until SingleTask and SingleInstance, I am getting more confused.
I…

Sam YC
- 10,725
- 19
- 102
- 158
8
votes
2 answers
android singleinstance activity not single if back button pressed
I encountered an interesting issue, where an Activity is created multiple times, even it is defined as a singleTask or a singelInstance Activity in the manifest. Here is how this can be reproduced. Say, in the main activity:
@Override
protected void…

Ákos Maróy
- 919
- 2
- 10
- 19
7
votes
1 answer
android singleTask activity not as the root?
I've been reading doc regarding to launch modes and there is one thing I don't understard. The doc says that singleTask activity is always the root of the stack:
In contrast, "singleTask" and "singleInstance" activities can only
begin a task.…

Tomask
- 2,344
- 3
- 27
- 37
7
votes
1 answer
Android : Create a single task with multiple applications' activities (Lauchmode issue)
I don't know how to tackle this Android issue. In few words, the flow between my 2 applications is as below :
Flow
Bind Application A to a service in Market application (AIDL)
Register a BroadcastReceiver and call a service method that returns a…

johann
- 1,115
- 8
- 34
- 60
7
votes
3 answers
Set activity launch mode programmatically
I need to call activity with different launchMode according to my app state. In one case it should be singleInstance, in other - singleTask. I know how to set launchMode in AndroidManifest, but since it should be dynamic property I have to do it…

OFFmind
- 597
- 1
- 5
- 13
6
votes
1 answer
Android onNewIntent from application launcher gives me the last intent
Im having an application that is SingleTask and is able listen to the 'testing' scheme.
If I click the button (see code) I relaunch myself and onNewIntent is called giving me the 'testing' intent (Now I might react to this by pushing a fragment)
Now…

joynes
- 1,627
- 4
- 16
- 19
6
votes
1 answer
Two instances of an Activity with launchMode as singleTask
I have an activity with launchMode as singleTask. But for some reason, two instances exist when I try to look for logs in "adb shell dumpsys activity activites" . The first instance is launched with intent={act= flg=0x10000000 cmp=} and the second…

dora
- 2,047
- 3
- 18
- 20