Lots of similar questions but I still can't find an answer. So I have a Fragment where I want to listen for changes in a PreferenceActivity
.
The documentation says to register the listener in onResume()
and un-register in onPause()
:
For proper lifecycle management in the activity, we recommend that you register and unregister your SharedPreferences.OnSharedPreferenceChangeListener during the onResume() and onPause() callbacks, respectively:
I assume they are referring to registering the listener from within the PreferenceActivity
onResume/onPause
methods, since if you unregister the listener in the Fragment's onPause()
, then it will not listen for the changes.
So is the solution to do the opposite i.e. - register in onPause()
and un-register in onResume()
?
Thanks!