Every time I attach a fragment to my activity, I want to register it to receive events from the activity. This is easy because I can override FragmentActivity#onAttachFragment(Fragment). When a fragment is removed from activity, I want to undo it from receiving events. I expected that there would be an event onDetachFragmentthat I could use in a similar way, but I do not find it.
Is there any other way to do what I'm trying to do? I would like to keep logging / logging in activity, rather than moving it to the base fragment class (where I could just use onAttach/ onDetach).
source
share