My project contains two fragment :
fragmentA when a c
You should call
fragmentTransaction.addToBackStack(null);
after performing all operations such as add(), remove(), and replace() and Just before commit(). Only then this transaction will be added to backstack. Only then you will be able to return to previous fragment state with Back button. Details here.