E - Type of the enum implementation of which value should be persisted.public final class EnumPreference<E extends Enum> extends SharedPreference<E>
BooleanPreference,
IntegerPreference,
LongPreference,
StringPreference,
FloatPreferenceSharedPreference.PreferenceChangeCallback<P>| Constructor and Description |
|---|
EnumPreference(String key,
E defValue)
Creates a new instance of EnumPreference with the specified key and defValue.
|
| Modifier and Type | Method and Description |
|---|---|
protected E |
onGetFromPreferences(android.content.SharedPreferences preferences)
Invoked to retrieve the actual value of this preference from the given shared preferences.
|
protected boolean |
onPutIntoPreferences(android.content.SharedPreferences preferences)
Invoked to persist the actual value into the given shared preferences.
|
createOnChangeListener, getDefaultValue, getKey, getValue, putIntoPreferences, updateValue@CheckResult
protected boolean onPutIntoPreferences(@NonNull
android.content.SharedPreferences preferences)
SharedPreferenceonPutIntoPreferences in class SharedPreference<E extends Enum>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.@Nullable protected E onGetFromPreferences(@NonNull android.content.SharedPreferences preferences)
SharedPreferenceonGetFromPreferences in class SharedPreference<E extends Enum>preferences - The instance of shared preferences into which was the value of this preference
before saved.