Save the date! Android Dev Summit is coming to Sunnyvale, CA on Oct 23-24, 2019.

androidx.preference

Classes

CheckBoxPreference

A Preference that provides checkbox widget functionality.

DialogPreference

A base class for Preferences that are dialog-based.

DropDownPreference

A ListPreference that presents the options in a drop down menu rather than a dialog.

EditTextPreference

A DialogPreference that shows a EditText in the dialog.

EditTextPreferenceDialogFragment

EditTextPreferenceDialogFragmentCompat

ListPreference

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

ListPreferenceDialogFragment

ListPreferenceDialogFragmentCompat

MultiSelectListPreference

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

MultiSelectListPreferenceDialogFragment

MultiSelectListPreferenceDialogFragmentCompat

Preference

The basic building block that represents an individual setting displayed to a user in the preference hierarchy.

PreferenceCategory

A container that is used to group similar Preferences.

PreferenceDataStore

A data store interface to be implemented and provided to the Preference framework.

PreferenceDialogFragment

Abstract base class which presents a dialog associated with a DialogPreference.

PreferenceDialogFragmentCompat

Abstract base class which presents a dialog associated with a DialogPreference.

PreferenceFragment

Shows a hierarchy of Preference objects as lists.

PreferenceFragmentCompat

A PreferenceFragmentCompat is the entry point to using the Preference library.

PreferenceGroup

A container for multiple Preferences.

PreferenceManager

Used to help create Preference hierarchies from activities or XML.

PreferenceScreen

A top-level container that represents a settings screen.

PreferenceViewHolder

A RecyclerView.ViewHolder class which caches views associated with the default Preference layouts.

SeekBarPreference

Preference based on android.

SwitchPreference

A Preference that provides a two-state toggleable option.

SwitchPreferenceCompat

A Preference that provides a two-state toggleable option.

TwoStatePreference

Common base class for preferences that have two selectable states, save a boolean value, and may have dependent preferences that are enabled/disabled based on the current state.

Extension functions summary

For PreferenceGroup
operator T?

Returns the preference with key, or null if no preference with key is found.

operator Preference

Returns the preference at index.

operator Boolean

Returns true if preference is found in this preference group.

operator Unit

Adds preference to this preference group.

operator Unit

Removes preference from this preference group.

Boolean

Returns true if this preference group contains no preferences.

Boolean

Returns true if this preference group contains one or more preferences.

Unit
PreferenceGroup.forEach(action: (preference: Preference) -> Unit)

Performs the given action on each preference in this preference group.

Unit
PreferenceGroup.forEachIndexed(action: (index: Int, preference: Preference) -> Unit)

Performs the given action on each preference in this preference group, providing its sequential index.

operator MutableIterator<Preference>

Returns a MutableIterator over the preferences in this preference group.

Extension properties summary

For PreferenceGroup
Int

Returns the number of preferences in this preference group.

Sequence<Preference>

Returns a Sequence over the preferences in this preference group.

Extension functions

contains

operator fun PreferenceGroup.contains(preference: Preference): Boolean

Returns true if preference is found in this preference group.

forEach

inline fun PreferenceGroup.forEach(action: (preference: Preference) -> Unit): Unit

Performs the given action on each preference in this preference group.

forEachIndexed

inline fun PreferenceGroup.forEachIndexed(action: (index: Int, preference: Preference) -> Unit): Unit

Performs the given action on each preference in this preference group, providing its sequential index.

get

inline operator fun <T : Preference> PreferenceGroup.get(key: CharSequence): T?

Returns the preference with key, or null if no preference with key is found.

get

operator fun PreferenceGroup.get(index: Int): Preference

Returns the preference at index.

Exceptions
IndexOutOfBoundsException if index is less than 0 or greater than or equal to the count.

isEmpty

inline fun PreferenceGroup.isEmpty(): Boolean

Returns true if this preference group contains no preferences.

isNotEmpty

inline fun PreferenceGroup.isNotEmpty(): Boolean

Returns true if this preference group contains one or more preferences.

iterator

operator fun PreferenceGroup.iterator(): MutableIterator<Preference>

Returns a MutableIterator over the preferences in this preference group.

minusAssign

inline operator fun PreferenceGroup.minusAssign(preference: Preference): Unit

Removes preference from this preference group.

plusAssign

inline operator fun PreferenceGroup.plusAssign(preference: Preference): Unit

Adds preference to this preference group.

Extension properties

children

val PreferenceGroup.children: Sequence<Preference>

Returns a Sequence over the preferences in this preference group.

size

inline val PreferenceGroup.size: Int

Returns the number of preferences in this preference group.