In my case have two fragment first one FragmentA and second is FragmentB in FragmentA when click button call
activity.getSupportFragmentManager().beginTransaction().replace(R.id.frameLayoutGallery,myFragment).addToBackStack(null).commit();
then show FragmentB , after in the second Fragment (FragmentB) button click call
int backStackId = getFragmentManager().getBackStackEntryAt(0).getId();
getFragmentManager().popBackStack(backStackId,FragmentManager.POP_BACK_STACK_INCLUSIVE);
after that it will show FragmentA content but how to catch isShow FragmentA exactly ??