I have a Preferences Screen which has some prefs that are interconnected. Which means, if I have pref x
and y
, I sometimes need y
to c
Try to call the setter of the preference itself instead updating it on your own:
E.g. EditTextPreference.setText(). So the preference itself updates it's own value too. If you do the update on your own the preference will not fetch the new value because it doesn't even know that the persisted value has changed.
If you have a PreferenceFragment
, you can get the preference with PreferenceFragment.findPreference().
If you have a PreferenceActivity
, you can get the preference with PreferenceActivity.findPreference().
You call that with the preference key you assigned in your settings XML file and you get an instance of the corresponding preference. Then you cast it to an CheckBoxPreference
, EditTextPreference
, etc (the type you set in your XML file).