Reputation: 373
Currently I have 3 Activity
classes A, B and C.
Activity A is a singleTask
while other has the default launch mode.
Consider a case: the user is first in A, then starts B, and then starts C.
The back stack now is ABC.
Next, the user starts A again.
The back stack now is A, but what I would like to be achieved is ABCA.
I know not setting Activity
A to be singleTask
can have a back stack : ABCA.
But I really need the Activity A to be the same instance.
Anyone know how to do this?
Upvotes: 0
Views: 205
Reputation: 1518
That is not possible.
if you want to open existing activity then
launch your activity as
Intent intent = new Intent(this, YourActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
startActivity(intent);
Upvotes: 0
Reputation: 2899
Are you sure you need singleTask
and not singleTop
? Could you describe why do you need it singleTask
?
Upvotes: 0
Reputation: 30601
You have stipulated two conditions:
what I would like to be achieved is ABCA.
and
I really need the Activity A to be the same instance.
These two conditions are mutually contradictory. Absolutely.
What you want is impossible.
That is all.
Upvotes: 2