How to close the current fragment by using Button like the back button?

前端 未结 13 879
失恋的感觉
失恋的感觉 2020-12-07 14:02

I have try to close the current fragment by using Imagebutton.

I am in Fragment-A and it will turn to the Fragment-B when I click the button.

And when I clic

13条回答
  •  粉色の甜心
    2020-12-07 14:49

    From Fragment A, to go to B, replace A with B and use addToBackstack() before commit().

    Now From Fragment B, to go to C, first use popBackStackImmediate(), this will bring back A. Now replace A with C, just like the first transaction.

提交回复
热议问题