You can create a static boolean that is changed whenever a preference is changed, or when your preference activity is started. The purpose of this boolean is to let your main activity know the preferences are dirty and need to be reloaded. They should be reloaded onResume
if the mDirty
flag is true.
Another option is to just reload all the preferences onResume
, regardless. This may not be as efficient, but if you don't have loads of preferences, it's fine.
The most efficient way would be to set onPreferenceChanged listeners for all your prefs in your prefs activity, the prefs then notify the activity only when they actually change. This solves the case when your user enters your prefs activity, but doesn't actually change anything.