I'm On the 4th fragment. On 4th fragment view when i click on cancel button it goes on 2nd fragment. but i use popBackStackImmediate it goes on 3rd fragment.
fmgr.popBackStackImmediate(2, 0);
or
fmgr.popBackStackImmediate(3, FragmentManager.POP_BACK_STACK_INCLUSIVE);
should do the trick
You can also name your fragment in your transaction
fmgr.beginTransaction()
.add(R.id.container, FRAGMENT, "your_fragment")
.addToBackStack("your_fragment")
.commitAllowingStateLoss();
fmgr.executePendingTransactions();
And then pop to this fragment:
fmgr.popBackStackImmediate("your_fragment", 0);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With