문제

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 an activity that is marked as "singleTask":

"... Instead, either a new task starts for the Browser or, if the Browser already has a task running in the background, that task is brought forward to handle the new intent."

According to the way singleTask is described, either a new task is created, or, if the activity already exists in some other task, that task is brought forward.

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.

도움이 되었습니까?

해결책

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.

다른 팁

"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 link http://developer.android.com/guide/topics/manifest/activity-element.html

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top