Skip to content Skip to sidebar Skip to footer

Activity Marked As "singletask" Brought Forward

I am trying to wrap my head around the different options of Android's Activity launch mode (See documentation: Tasks and Back Stack According to the documentation, when launching

Solution 1:

You asked:

What happens in case an instance of the Browser activity (for example) already exists in the same task (stack) of my app's activity (but not in the foreground) ? How is it brought forward? This is not described in the doc.

It is not possible for an instance of the Browser activity (to use your example) to exist in your app's task stack, because that Activity has been defined with singleTask launch mode and has a different taskAffinity from the other activities in your app. Therefore, whenever the Browser activity is launched, it will always be launched into its own task, and not into your task.

Solution 2:

"SingleTask" - The system creates the activity at the root of a new task and routes the intent to it. However, if an instance of the activity already exists, the system routes the intent to existing instance through a call to its onNewIntent() method, rather than creating a new one.

Note: SingleTask and SingleInstance are used for specialized launches . It is not recommended for general use

From this linkhttp://developer.android.com/guide/topics/manifest/activity-element.html

Post a Comment for "Activity Marked As "singletask" Brought Forward"