How to remove current and show previous fragment? Like if I’m press “Back” button
I’m using such construction:
FragmentManager fm=getFragmentManager();
FragmentTransaction ft=fm.beginTransaction();
ft.remove(fragment).commit();
But it just removes current fragment, without showing previous
You have to call
FragmentTransaction.addToBackStack(null)where you add the fragment and then callFragmentManager.popBackStack()when you want to remove it.