sakis kaliakoudas
sakis kaliakoudas

Reputation: 2089

android Intent.FLAG_ACTIVITY_REORDER_TO_FRONT not working as intended

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:

  1. The application starts with activity A
  2. Then I click the button to go to B
  3. I press the back button.
  4. Activity A is displayed (works as expected)

Second scenario

  1. The application starts with activity A
  2. Then I click the button to go to B
  3. Then I click the button to go to A
  4. Then I click the back button
  5. 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.

Upvotes: 2

Views: 5670

Answers (1)

sakis kaliakoudas
sakis kaliakoudas

Reputation: 2089

This is a duplicate of this: Puzzling behavior with REORDER_TO_FRONT

Apparently this is an android bug on API 19.

For more details see the bug report: https://code.google.com/p/android/issues/detail?id=63570#c2

Upvotes: 2

Related Questions