added in version 24.1.0
belongs to Maven artifact


public class ListPreference
extends DialogPreference

Known Direct Subclasses

A Preference that displays a list of entries as a dialog.

This preference will store a string into the SharedPreferences. This string will be the value from the setEntryValues(CharSequence[]) array.


Inherited XML attributes

From class

Inherited constants

From class

Public constructors

ListPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
ListPreference(Context context, AttributeSet attrs, int defStyleAttr)
ListPreference(Context context, AttributeSet attrs)
ListPreference(Context context)

Public methods

int findIndexOfValue(String value)

Returns the index of the given value (in the entry values array).

CharSequence[] getEntries()

The list of entries to be shown in the list in subsequent dialogs.

CharSequence getEntry()

Returns the entry corresponding to the current value.

CharSequence[] getEntryValues()

Returns the array of values to be saved for the preference.