Looks like Every tutorial that we have got out there on the Web mentions that
FLAG_ACTIVITY_NEW_TASK Starts a new task if the Activity we are starting is not currently running in the task.But it seems that using
FLAG_ACTIVITY_NEW_TASK doesn't Creates a New Task Always, it is only Creating a new task if there is no task available for the activity we need to run like when we start an activity from a
BroadCastReceiver using the context inside
onReceive().
According to the all the tutorials on the web,
Suppose We have got following activities in our BackStack-
A->B->C
Now If We want to start a new Activity D, then it should start in a New Task, but this doesn't seems to happens and the activity D is Started in the Same task and we have out final backstack
A->B->C->D
AnyOne Who Can Clarify?
What I have tried:
I know Setting Affinity will result in new task but this brings another problem:
Try Yourself:
Suppose we launch two Activity:
A-B
Then again we launch one other Activity with android:taskAffinity**,So now we have got**
A-B | C
A-B (on the same task)
C (on other task)
Now Again We start A-B from C,So now our BackStack will Look like:
A-B|C-A-B
A-B(on the same task)
C-A-B(on other task)
Now, the problem is If We will Again try to start C from B (from task C-A-B), nothing happens and C will not get launch (I din't know why?)