Android: Notes on using a PreferenceFragment with the Google Navigation Drawer code (Fragment lifecycle methods)

These are some notes on what happens when I use a PreferenceFragment with the Google Navigation Drawer code.

These are the Fragment lifecycle methods that are run when I go to my PreferenceFragment the first time:

I/VPPreferencesFragment﹕ ENTERED onCreate
I/VPPreferencesFragment﹕ ENTERED onCreateView
I/VPPreferencesFragment﹕ ENTERED onViewCreated
I/VPPreferencesFragment﹕ ENTERED onActivityCreated
I/VPPreferencesFragment﹕ ENTERED registerPreferencesChangeListener
I/VPPreferencesFragment﹕ ENTERED onStart
I/VPPreferencesFragment﹕ ENTERED onResume

Then when I go back to the Navigation Drawer, and tap Preferences, I see these lifecycle methods:

I/VPPreferencesFragment﹕ ENTERED onPause
I/VPPreferencesFragment﹕ ENTERED onStop
I/VPPreferencesFragment﹕ ENTERED onDestroyView
I/VPPreferencesFragment﹕ ENTERED onDestroy
I/VPPreferencesFragment﹕ ENTERED onDetach
I/VPPreferencesFragment﹕ ENTERED onCreate
I/VPPreferencesFragment﹕ ENTERED onCreateView
I/VPPreferencesFragment﹕ ENTERED onViewCreated
I/VPPreferencesFragment﹕ ENTERED onActivityCreated
I/VPPreferencesFragment﹕ ENTERED registerPreferencesChangeListener
I/VPPreferencesFragment﹕ ENTERED onStart
I/VPPreferencesFragment﹕ ENTERED onResume

I used this log output to debug a specific problem today, but if you need to debug a Fragment's lifecycle methods, you can see from this example which lifecycle methods are called when a Fragment is first created, and then when the Fragment is reused.