I have a listPreference in Settings in my App. And i have a onSharedPreferenceChanged() method where i do something if the value was changed. But if user click on the same list item onSharedPreferenceChanged() called again. But i dont want to do anything if user clicked on the same row in listPreference… How to handle that ? How to check in onSharedPreferenceChanged() if the value was change or not ? Thanks.
For example
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
String key) {
if (key.equals(SOME_KEY)) {
setResult(2);
}
}
But I dont wont to set result if the value is the same
You’d better do that in
Preference.OnPreferenceChangeListenersubclass.