Reputation: 203
I have doubt with android backstack , please consider the scenario I have two activities A and B in same app ,
FLAG_ACTIVITY_NEW_TASK
FLAG_ACTIVITY_NEW_TASK
My question is how does the backstack work with this flag , is new task created every time and previous task is pushed to background or activity is created on top of same task.
My doubt is if first one is correct then does back button really remove the activity from top of the stack and if second is correct what is the use of that flag in correct sense.
Thanks in advance.
Regards, Rohit
Upvotes: 2
Views: 862
Reputation: 95578
First of all, launching B using FLAG_ACTIVITY_NEW_TASK
will NOT create a new task unless you have explicitly set android:taskAffinity
in the manifest for B. The reason for this is that, by default, all Activities in your application have the same taskAffinity
and taskAffinity
overrides FLAG_ACTIVITY_NEW_TASK
.
If you have set the taskAffinity of A and/or B so that they are different (or both empty), then it works like this:
Upvotes: 2