Fix for when an IntListPreference was previously stored in a ListPreference

This commit is contained in:
str4d
2015-04-16 00:51:15 +00:00
parent 1d02535158
commit 93d2677b34

View File

@ -15,6 +15,15 @@ public class IntListPreference extends ListPreference {
@Override
protected boolean persistString(String value) {
if (getSharedPreferences().contains(getKey())) {
try {
getPersistedInt(0);
} catch (ClassCastException e) {
// Fix for where this preference was previously stored in a ListPreference
getSharedPreferences().edit().remove(getKey()).commit();
}
}
return value != null && persistInt(Integer.valueOf(value));
}