How can I retain fragments from backstack on orientation changes?
I'm using this code to add fragments to backstack:
FragmentManager fragmentManager = getFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.container, fragment, tag);
fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
fragmentTransaction.addToBackStack(null);
fragmentTransaction.commit();
But they disappear when I change device orientation.
I'm trying to reproduce the behavior of fragments in Google Play.