Android fragment transaction listener
问题 I need to listen when a fragment transaction is performed, for example, when I replace a fragment with another, without call to addToBackStack(). FragmentManager class provides a addOnBackStackChangedListener callback, but when I perform a fragment replacement without call to addToBackStack, it is not executed. Edit: the listen operation is performed in a class which only have access to the activity instance and its fragment manager. 回答1: You can use Base class for all your fragments. Then