I have this scenario: in Activity A, it navigate as this order: fragment F1 -> fragment F2, then, clicking a button in F2, it launched another Activity B.
Now what I want to achieve: when hitting the "Back" button in Device while in Activity B, I want to go back F1 in Activity A.
Please note that this involves 2 activities, not back in the same activity. I am thinking to pop up the last fragment F2 when leaving Activity A. But I couldn't figure out how to do that. I tried to add these in onSaveInstanceState(Bundle outState)
in Activity A:
fragmentManager.popBackStackImmediate();
But it seems not to be working at all.