I have two activities A and B. Activity A has a mapFragment and I am adding it to backstack. When I come back from to Actvity A from B, I want the fragment to show up in same state as I left it. But getFragmentManager().getBackStackEntryCount() is returning me 0. Here is my code:
MapFragment mMapFragment = MapFragment.newInstance();
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
mMapFragment.getMapAsync(this);
fragmentTransaction.replace(R.id.container, mMapFragment);
fragmentTransaction.addToBackStack(null);
fragmentTransaction.commit();
getFragmentManager().executePendingTransactions();
When coming back from activity B, I have this to know number of getBackStackEntryCount():
System.out.println("Number of entries in backstack "+ getFragmentManager().getBackStackEntryCount());
which is showing me 0.
Thanks in advance.