T - Type of items within a list of which values should be persisted.CollectionPreference instead.@Deprecated public final class ListPreference<T> extends SharedPreference<List<T>>
A SharedPreference implementation that may be used to persist a List of values
via SharedPreferences.
ArrayPreferenceSharedPreference.PreferenceChangeCallback<P>| Constructor and Description |
|---|
ListPreference(int keyResId,
Class<T> componentType,
List<T> defValue)
Deprecated.
Use
ListPreference(String, Class, List) instead. |
ListPreference(String key,
Class<T> componentType,
List<T> defValue)
Deprecated.
Creates a new instance of ListPreference.
|
| Modifier and Type | Method and Description |
|---|---|
static <T> List<T> |
getFromPreferences(android.content.SharedPreferences preferences,
String key,
List<T> defValue)
Deprecated.
Returns a
List mapped in the given shared preferences under the specified
key. |
protected List<T> |
onGetFromPreferences(android.content.SharedPreferences preferences)
Deprecated.
Invoked to retrieve the actual value of this preference from the given shared preferences.
|
protected boolean |
onPutIntoPreferences(android.content.SharedPreferences preferences)
Deprecated.
Invoked to persist the actual value into the given shared preferences.
|
static <T> boolean |
putIntoPreferences(android.content.SharedPreferences preferences,
String key,
List<T> list,
Class<T> componentType)
Deprecated.
Saves the given list into the given shared preferences.
|
attachKey, createOnChangeListener, getDefaultValue, getKey, getKeyRes, getValue, putIntoPreferences, retrieve, save, updateValuepublic ListPreference(String key, Class<T> componentType, List<T> defValue)
componentType - Class of components that will be presented within a list managed by the
new list preference.SharedPreference.SharedPreference(String, Object)@Deprecated public ListPreference(int keyResId, Class<T> componentType, List<T> defValue)
ListPreference(String, Class, List) instead.Creates a new instance of ListPreference.
componentType - Class of components that will be presented within a list managed by the
new list preference.SharedPreference.SharedPreference(int, Object)protected boolean onPutIntoPreferences(android.content.SharedPreferences preferences)
SharedPreferenceonPutIntoPreferences in class SharedPreference<List<T>>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.putIntoPreferences(SharedPreferences, String, List, Class)public static <T> boolean putIntoPreferences(android.content.SharedPreferences preferences,
String key,
List<T> list,
Class<T> componentType)
T - Type of items which are presented within the given list.preferences - The instance of shared preferences into which will be the given list saved.key - The key under which will be the saved list mapped in the shared preferences.list - List to save into preferences.componentType - Class of components presented within the given list.True if saving has succeeded, false otherwise.protected List<T> onGetFromPreferences(android.content.SharedPreferences preferences)
SharedPreferenceonGetFromPreferences in class SharedPreference<List<T>>preferences - The instance of shared preferences into which was the value of this preference
before saved.getFromPreferences(SharedPreferences, String, List)public static <T> List<T> getFromPreferences(android.content.SharedPreferences preferences, String key, List<T> defValue)
List mapped in the given shared preferences under the specified
key.T - Type of an items which should be presented within the obtained list.preferences - The instance of shared preferences into which was the requested list
before saved.key - The key under which is the saved list mapped in the shared preferences.defValue - Default list to return if there is no mapping for the specified key
yet.ClassCastException - If value stored under the specified key does not represents
an array/a list.IllegalArgumentException - If type of the requested list is not supported by the
Preferences library.IllegalStateException - If the requested list was not stored by the Preferences library.