I know that I can do something like this:
Preference pref = findPreference(getString(R.string.pref_vibrate_on_key));
pref.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference,
Object newValue) {
LogUtil.d("Working!");
return true;
}
});
But I would like to add a Listener to every preference. I tried doing:
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
sp.registerOnSharedPreferenceChangeListener(new OnSharedPreferenceChangeListener() {
@Override
public void onSharedPreferenceChanged(
SharedPreferences sharedPreferences, String key) {
LogUtil.d("working!");
}
});
but it doesn't work. Is this possible? If so, what am I doing wrong?