So, I have 4 activities Activity Activity1
, Activity2
, Activity3
and Activity4
. I start from Activity1
then on some event I start Activity2
then on some event on Activity2
I start Activity3
as a new task as
public void onClick(View v) {
Intent intent = new Intent(Activity2.this, Activity3.class);
intent.setFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK|Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
Here Activity2
launchMode is decalared as singleTask.
Then I navigate from Activity3
to Activity4
When I start Activity2
from Activity4
I believe it should have backstack like
Task A
|Activity2|
|Activity1|
Task B
|Activity4|
|Activity3|
but instead new instance of Activity2
is added to the current task as
Task B
|Activity2|
|Activity4|
|Activity3|
Task A
|Activity2|
|Activity1|
can someone please help me understand this?