E - A type of the enum implementation of which value will this preference manage.public final class EnumPreference<E extends Enum> extends SharedPreference<E>
SharedPreference implementation that may be used to manage (store/retrieve) an Enum
preference value within SharedPreferences.BooleanPreference,
IntegerPreference,
LongPreference,
StringPreference,
FloatPreferenceSharedPreference.PreferenceChangeCallback<PreferenceType>| Constructor and Description |
|---|
EnumPreference(int keyResId,
E defValue)
Creates a new instance of EnumPreference.
|
EnumPreference(String key,
E defValue)
Creates a new instance of EnumPreference.
|
| 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 save the actual value into the given shared preferences.
|
attachKey, createOnChangeListener, getDefaultValue, getKey, getKeyRes, getValue, retrieve, save, updateValuepublic EnumPreference(String key, E defValue)
public EnumPreference(int keyResId,
E defValue)
protected boolean onPutIntoPreferences(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 saved.True if saving operation succeed, false otherwise.protected E onGetFromPreferences(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.