pop 2 fragment from backstack code example
Example 1: Pop fragment from backstack
getActivity().getSupportFragmentManager().popBackStack();
Example 2: Pop fragment from backstack
FragmentManager fm = getSupportFragmentManager();
if (fm.getBackStackEntryCount() > 0) {
fm.popBackStack();
}else {
super.onBackPressed();
}