How to notify your Fragment of different user navigation events

If you are using Android Fragments in your app, it can sometimes be useful to know when a user is navigation away from your fragment, so that you can act upon the users action, either by saving away data, asking the user for a confirmation, or what else. Here I will describe three methods of registering navigation events. Telling the Fragment that the back button has been pressed, through a reference to your fragment If you would like to know

» Read more