What is the difference between android:launchMode and android:documentLaunchMode attribute?
Asked Answered
T

2

13

So I have been reading the docs on Tasks, Back Stack and Overview Screen and there is one thing that immensely confuses me. After having read launchMode here: http://developer.android.com/guide/components/tasks-and-back-stack.html then about documentLaunchMode here: http://developer.android.com/guide/components/recents.html I can't tell how they differ!

Both have been depicted to provide ways to control launch of new Activity in tasks relative to current task(The task of launching activity). So how these 2 modes are different? What does the appending of -document imply?

Here are the docs which directly refers to their use in the manifest file:
LaunchMode: http://developer.android.com/guide/topics/manifest/activity-element.html#lmode
DocumentLaunchMode: http://developer.android.com/guide/topics/manifest/activity-element.html#dlmode

Talia answered 22/8, 2015 at 8:31 Comment(1)
Hi @pulp_fiction, Did you find the answer? myself also couldn't figure out the difference.Bahaism
P
4

Let's take a quick look at the launchMode values:

standard and singleTop both allow multiple instances of an activity to be created, within other tasks.

singleTask and singleInstance both limit an activity to a single instance, as the first activity in its task.

Anything seem to be missing to you? None of these values allow multiple instances of an activity to be created at the top level. Either you launch instances of your activity into other people's tasks, or you limit it to a single instance. None of these values allow multiple tasks to be created to host your activity. This oversight is what documentLaunchMode addresses. The idea is that if your activity has an intent filter that allows it to view documents, that each of those documents -- each data uri -- should be able to get its own instance of your activity in its own task.

Phare answered 10/11, 2017 at 18:17 Comment(0)
C
0

DocumentLaunchMode is control the app task display in the recent task list(the third button in the guide bar). Just like You open a WebSite in Chrome,and you can open many tab about this Site.

Cuttler answered 22/8, 2015 at 9:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.