I am trying to remove a fragment from my stack. I am using this code:
FragmentManager fm = getSupportFragmentManager();
if (fm != null) {
FragmentTransaction ft = fm.beginTransaction();
Fragment currentFragment = fm.findFragmentById(R.id.my_id);
if (currentFragment != null) {
ft.remove(currentFragment);
ft.commit();
}
}
Do I need to call popBackStack() with the above code?
fm.popBackStack();