I\'m registering a preference change listener like this (in the onCreate()
of my main activity):
SharedPreferences prefs = PreferenceManager.get
So, I don't know if this would really help anyone though, it solved my issue.
Even though I had implemented the OnSharedPreferenceChangeListener
as stated by the accepted answer. Still, I had an inconsistency with the listener being called.
I came here to understand that the Android just sends it for garbage collection after some time. So, I looked over at my code.
To my shame, I had not declared the listener GLOBALLY but instead inside the onCreateView
. And that was because I listened to the Android Studio telling me to convert the listener to a local variable.