What I already known is:
after fragmentTransaction.replace()
, current fragment's onStop()
function will be called
while fragmentTransaction.add()
won't.
and after calling fragMgr.popBackStack();
, we will return to previous fragment no matter fragmentTransaction.replace
or fragmentTransaction.add()
is used
So what does fragmentTransaction.replace
do?
I can understand we can "add" a fragment opon a previous fragment and later return to previous fragment by popBackStack()
, BUT:
if previous fragment is "replaced" by current fragment, I guess previous fragment is removed and current fragment is added in, how can it return to previous fragment when popBackStack()
called?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…