What is the main difference between calling these methods:
fragmentTransaction.addToBackStack(name);
fragmentTransaction.replace(containerViewId, fragment, tag);
fragmentTransaction.add(containerViewId, fragment, tag);
What does it mean to replace an already existing fragment, and adding a fragment to the activity state, and adding an activity to the back stack?
Secondly, with findFragmentByTag()
, does this search for tag added by the add()
/replace()
method or the addToBackStack()
method?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…