androidx.preference
The Preference library allows you to build interactive settings screens, without needing to handle interacting with device storage or managing the user interface.
Interfaces
DialogPreference.TargetFragment |
Interface for |
EditTextPreference.OnBindEditTextListener |
Interface definition for a callback to be invoked when the corresponding dialog view for this preference is bound. |
Preference.OnPreferenceChangeListener |
Interface definition for a callback to be invoked when the value of this |
Preference.OnPreferenceClickListener |
Interface definition for a callback to be invoked when a |
Preference.SummaryProvider |
Interface definition for a callback to be invoked when the summary of this |
PreferenceFragment.OnPreferenceDisplayDialogCallback |
Interface that the fragment's containing activity should implement to be able to process preference items that wish to display a dialog. |
PreferenceFragment.OnPreferenceStartFragmentCallback |
Interface that the fragment's containing activity should implement to be able to process preference items that wish to switch to a specified fragment. |
PreferenceFragment.OnPreferenceStartScreenCallback |
Interface that the fragment's containing activity should implement to be able to process preference items that wish to switch to a new screen of preferences. |
PreferenceFragmentCompat.OnPreferenceDisplayDialogCallback |
Interface that the fragment's containing activity should implement to be able to process preference items that wish to display a dialog. |
PreferenceFragmentCompat.OnPreferenceStartFragmentCallback |
Interface that the fragment's containing activity should implement to be able to process preference items that wish to switch to a specified fragment. |
PreferenceFragmentCompat.OnPreferenceStartScreenCallback |
Interface that the fragment's containing activity should implement to be able to process preference items that wish to switch to a new screen of preferences. |
PreferenceGroup.PreferencePositionCallback |
Interface for PreferenceGroup adapters to implement so that |
PreferenceManager.OnDisplayPreferenceDialogListener |
Interface definition for a class that will be called when a |
PreferenceManager.OnNavigateToScreenListener |
Interface definition for a class that will be called when a |
PreferenceManager.OnPreferenceTreeClickListener |
Interface definition for a callback to be invoked when a |
Classes
CheckBoxPreference |
A |
DialogPreference |
A base class for |
DropDownPreference |
A |
EditTextPreference |
A |
EditTextPreference.SimpleSummaryProvider |
A simple |
EditTextPreferenceDialogFragment |
This class is deprecated. Use |
EditTextPreferenceDialogFragmentCompat |
|
ListPreference |
A |
ListPreference.SimpleSummaryProvider |
A simple |
ListPreferenceDialogFragment |
This class is deprecated. Use |
ListPreferenceDialogFragmentCompat |
|
MultiSelectListPreference |
A |
MultiSelectListPreferenceDialogFragment |
This class is deprecated. Use |
MultiSelectListPreferenceDialogFragmentCompat |
|
Preference |
The basic building block that represents an individual setting displayed to a user in the preference hierarchy. |
Preference.BaseSavedState |
A base class for managing the instance state of a |
PreferenceCategory |
A container that is used to group similar |
PreferenceDataStore |
A data store interface to be implemented and provided to the |
PreferenceDialogFragment |
This class is deprecated. Use |
PreferenceDialogFragmentCompat |
Abstract base class which presents a dialog associated with a |
PreferenceFragment |
This class is deprecated. Use |
PreferenceFragmentCompat |
A PreferenceFragmentCompat is the entry point to using the Preference library. |
PreferenceGroup |
A container for multiple |
PreferenceHeaderFragmentCompat |
|
PreferenceManager |
Used to help create |
PreferenceManager.PreferenceComparisonCallback |
Callback class to be used by the |
PreferenceManager.SimplePreferenceComparisonCallback |
A basic implementation of |
PreferenceScreen |
A top-level container that represents a settings screen. |
PreferenceViewHolder |
A |
SeekBarPreference |
Preference based on android.preference.SeekBarPreference but uses support preference as a base . |
SwitchPreference |
A |
SwitchPreferenceCompat |
A |
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
operator Boolean |
PreferenceGroup.contains(preference: Preference)Returns |
inline Unit |
PreferenceGroup.forEach(action: (preference: Preference) -> Unit)Performs the given action on each preference in this preference group. |
inline Unit |
PreferenceGroup.forEachIndexed(Performs the given action on each preference in this preference group, providing its sequential index. |
operator Preference |
PreferenceGroup.get(index: Int)Returns the preference at |
inline operator T? |
<T : Preference> PreferenceGroup.get(key: CharSequence)Returns the preference with |
inline Boolean |
Returns true if this preference group contains no preferences. |
inline Boolean |
Returns true if this preference group contains one or more preferences. |
operator Iterator<Preference> |
Returns a |
inline operator Unit |
PreferenceGroup.minusAssign(preference: Preference)Removes |
inline operator Unit |
PreferenceGroup.plusAssign(preference: Preference)Adds |
Extension properties summary
Sequence<Preference> |
Returns a |
Int |
Returns the number of 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
operator fun PreferenceGroup.get(index: Int): Preference
Returns the preference at index.
| Throws | |
|---|---|
kotlin.IndexOutOfBoundsException |
if index is less than 0 or greater than or equal to the count. |
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.
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(): Iterator<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.