I am having a weird problem with FLAG_ACTIVITY_REORDER_TO_FRONT. I have 2 activities, A and B. A has a button to move to B and B has a button to move to A. So here we go.
First scenario:
- The application starts with activity A
- Then I click the button to go to B
- I press the back button.
- Activity A is displayed (works as expected)
Second scenario
- The application starts with activity A
- Then I click the button to go to B
- Then I click the button to go to A
- Then I click the back button
- My application closes
Shouldn't my application go to B when i click the back button ? Even when I do a
adb shell
dumpsys activity | grep -i run
right before clicking the back button, it displays 2 activities in the stack, A on top and B right under it.
P.S. I am using the Intent.FLAG_ACTIVITY_REORDER_TO_FRONT to handle more complex scenarios when using these activities (and many more), that interestingly work just fine. It's only when I only have 2 Activities that I get this early exit of the application.