Android 12 Developer Preview is here! Try it out, and give us your feedback!


open class ListPreference : DialogPreference
   ↳ androidx.preference.Preference
   ↳ androidx.preference.DialogPreference
   ↳ androidx.preference.ListPreference

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

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


Nested classes

A simple androidx.preference.Preference.SummaryProvider implementation for a ListPreference.

Inherited constants
Public constructors
<init>(context: Context!, attrs: AttributeSet!, defStyleAttr: Int, defStyleRes: Int)

<init>(context: Context!, attrs: AttributeSet!, defStyleAttr: Int)

<init>(context: Context!, attrs: AttributeSet!)

<init>(context: Context!)

Public methods
open Int

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

open Array<CharSequence!>!

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

open CharSequence!

Returns the entry corresponding to the current value.

open Array<CharSequence!>!

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

open CharSequence!

open String!

Returns the value of the key.

open Unit

Sets the human-readable entries to be shown in the list.

open Unit
setEntries(@ArrayRes entriesResId: Int)

open Unit

The array to find the value to save for a preference when an entry from entries is selected.

open Unit
setEntryValues(@ArrayRes entryValuesResId: Int)

open Unit

open Unit
setValue(value: String!)

Sets the value of the key.

open Unit

Sets the value to the given index from the entry values.

Protected methods
open Any!

open Unit

open Parcelable!

open Unit
onSetInitialValue(defaultValue: Any?)

Inherited functions