Is there a way that when we use ft.addToBackStack(null);
we only add a single instance to the BackStack? Adding multiple instances of the same fragment to the Back Stack creates a clutter when the user presses the Back Button?
You could try setting a string to the addToBackStack method. Ex
ft.addToBackStack("fragmentA");
Later then, if you are coing to insert that same fragment again. You do this before adding it to the layout.
getFragmentManager().popBackStack("fragmentA", FragmentManager.POP_BACK_STACK_INCLUSIVE);
http://developer.android.com/reference/android/app/FragmentManager.html#popBackStack(java.lang.String, int)
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