1

How to add fragment to back stack, but replacing last history ? Example below.

[frag1].addToBackStack(null) 
     -> [frag2].addToBackStack(null) 
         -> [frag3].addToBackStack(null) // need here replace frag2 in history (back button get to frag1)
marioosh
  • 27,328
  • 49
  • 143
  • 192

1 Answers1

2

You can use getFragmentManager().popBackStack(); to remove frag2 to the backstack and getFragmentManager().beginTransaction().replace(...) to change the frag3 by other.

Hope it helps you!