Is there a way to remove all fragments which already added the specific view with its view id?
For example I want to remove all fragments which is added R.id.fragmentcon
It is indeed very simple.
private static void removeAllFragments(FragmentManager fragmentManager) { while (fragmentManager.getBackStackEntryCount() > 0) { fragmentManager.popBackStackImmediate(); } }