Regularly who determines the transaction of Fragments is the Activity, the simplest option is to call the
onBackPressed() of the
Activity that contains the
and in the
onBackPressed() of the Activity method you obtain the Fragment that was added to the BackStack.
public void onBackPressed()
if(getFragmentManager().getBackStackEntryCount() > 0)
For this to work, remember to add the fragments to the BackStack with