Reputation: 295
I have the following constellation:
Press App Icon open Activity A, which checks which activity should open next (Registration or Main Activity B). A is marked as Main Launcher in the xml. Now I go to B. Then I have a user action and come to Activity C. Now I press home. If I chose the app again from background task selector i come back to C. But when I instead press the app icon again,I will start again with A. Is it possible to handle it in manifest that in this case C should open again or do I have to care it by myself (e.g. via SharedPreferences?)
Upvotes: 0
Views: 403
Reputation: 28239
This behavior can be controlled in the manifest
via android:launchMode
.
See here: https://developer.android.com/guide/topics/manifest/activity-element.html#lmode and more explanation here: https://developer.android.com/guide/components/tasks-and-back-stack.html
for your scenario, you'd want to keep C and route new intents to the existing instance of it, so this might work:
<activity
android:name="A"
...
android:launchMode="singleTask" />
<activity
android:name="B"
...
android:launchMode="singleTask" />
<activity
android:name="C"
...
android:launchMode="singleTask" />
Upvotes: 1