I am working on fragment transaction, and the backstack is like this:
fragA => fragB => fragC => fragD
I would like to return to f
The backstack contains records about transactions, not fragments itself.
So you should not add first transaction's record (null -> fragA) to backstack.
And all other transaction's record should be added to backstack.
In this case, then you preformpopBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE); android removed all fragments except fragA, because there isn't any records about how fragA was added.