1

Suppose I have a task in which I have A, B & C Activities respectively. And then I'm starting a new Activity D which has singleInstance as it's launchMode.

Now, I wonder what happens in the task level? Will the same task be preserved but contains only Activity D or new task is created?

Onik
  • 19,396
  • 14
  • 68
  • 91
stdout
  • 2,471
  • 2
  • 31
  • 40

1 Answers1

0

A new task will be created with the single Activity D. From the documentation:

Same as "singleTask", except that the system doesn't launch any other activities into the task holding the instance. The activity is always the single and only member of its task.

So you'll get

Task 1: A,B,C
Task 2: D

The following two sequence are correct which confirms the docs:

  1. A -> B -> C -> D -> back -> C -> back -> B -> back -> A -> back -> Home Screen (HS)
  2. A -> B -> C -> D -> HS -> calling your task from recent apps -> D -> back -> HS
Onik
  • 19,396
  • 14
  • 68
  • 91
  • We also take the taskAffinity property into consideration as well. If the affinities are the same then no new task will be created. – stdout Feb 04 '15 at 09:13