Java tutorial
//package com.java2s; //License from project: Open Source License import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; import java.util.Stack; public class Main { public static void popPreviousFragmentFromStack(FragmentManager fragmentManager, Stack<Fragment> fragmentStack) { FragmentTransaction ft = fragmentManager.beginTransaction(); fragmentStack.lastElement().onPause(); ft.remove(fragmentStack.pop()); fragmentStack.lastElement().onResume(); ft.show(fragmentStack.lastElement()); ft.commit(); } }