I read docs about activity stack and searching for an answer on forums but I can’t find a solution for my problem.
I have activity A (which is a ImageView) and activity B (is a GridView). When user clicks on some picture in GridView activity A opens with corresponding Image.
So I have such situation in activity stack after choosing another picture in GridView:
… -> A(picture 1) -> B(grid) -> A(picture 2)
But I want to have: … -> B(grid) – A(picture 2)
I tried different launch modes:
if A is a singleInstance – after choosing any picture in grid, activity A opens with old image
if A is a singleTask – i get situation: A(picture 1) -> B(grid) -> A(picture 2)
Can anybody give me a point how manage my activities the way I need?
Thanks
Override the onPause() of Activity A and call finish();
Therefore when ‘back’ is pressed on the ImageView it will remove it from the stack.
Then your stack will only ever be: Grid -> Image
Also if your activity is sent to the background (with home button) your stack will be: Grid