I have an app that has a single activity where all the screens are displayed as fragments.
So when most of the times I am changing the fragment I add it to the back stack. So the BackStack can get quite big.
getActivity().getSupportFragmentManager()
.beginTransaction()
.replace(R.id.leftPane, new ReleaseFragmentBuilder(releaseId).build())
.addToBackStack(null)
.commit();
My question is if I want to replace a fragment but do not keep the BackStack anymore(BackStack Reset) , one option is to clear the BackStack by doing a PopBackStack until root (which is super inefficient and have seen other problems) OR to do a fragment replace WITHOUT adding it to the BackStack
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.leftPane, new HomeFragment())
.commit();
So What do you recommend? If I use only the replace , Does it have any memory issues?