public final class IntegerPreference extends SharedPreference<Integer>
SharedPreference implementation that may be used to persist a Integer value via
SharedPreferences.BooleanPreference,
StringPreference,
LongPreference,
FloatPreference,
EnumPreferenceSharedPreference.PreferenceChangeCallback<P>| Constructor and Description |
|---|
IntegerPreference(String key,
Integer defValue)
Creates a new instance of IntegerPreference with the specified key and defValue.
|
| Modifier and Type | Method and Description |
|---|---|
protected Integer |
onGetFromPreferences(SharedPreferences preferences)
Invoked to retrieve the actual value of this preference from the given shared preferences.
|
protected boolean |
onPutIntoPreferences(SharedPreferences preferences)
Invoked to persist the actual value into the given shared preferences.
|
createOnChangeListener, getDefaultValue, getKey, getValue, putIntoPreferences, updateValue@CheckResult protected boolean onPutIntoPreferences(@NonNull SharedPreferences preferences)
SharedPreferenceonPutIntoPreferences in class SharedPreference<Integer>preferences - The instance of shared preferences into which should be the current value
of this preference persisted.True if put has been successful, false otherwise.@NonNull protected Integer onGetFromPreferences(@NonNull SharedPreferences preferences)
SharedPreferenceonGetFromPreferences in class SharedPreference<Integer>preferences - The instance of shared preferences into which was the value of this preference
before saved.