get the latest fragment in backstack
问题 How can I get the latest fragment instance added in backstack (if I do not know the fragment tag & id)? FragmentManager fragManager = activity.getSupportFragmentManager(); FragmentTransaction fragTransacion = fragMgr.beginTransaction(); /****After add , replace fragments (some of the fragments are add to backstack , some are not)***/ //HERE, How can I get the latest added fragment from backstack ?? 回答1: You can use the getName() method of FragmentManager.BackStackEntry which was introduced in