Preference
open class Preference : Comparable<Preference!>
kotlin.Any | |
↳ | androidx.preference.Preference |
The basic building block that represents an individual setting displayed to a user in the preference hierarchy. This class provides the data that will be displayed to the user and has a reference to the SharedPreferences
or PreferenceDataStore
instance that persists the preference's values.
When specifying a preference hierarchy in XML, each element can point to a subclass of Preference
, similar to the view hierarchy and layouts.
This class contains a key
that that represents the key that is used to persist the value to the device. It is up to the subclass to decide how to store the value.
Summary
Nested classes | |
---|---|
open |
A base class for managing the instance state of a |
abstract |
Interface definition for a callback to be invoked when the value of this |
abstract |
Interface definition for a callback to be invoked when a |
abstract |
Interface definition for a callback to be invoked when the summary of this |
Constants | |
---|---|
static Int |
Specify for |
Public constructors | |
---|---|
<init>(context: Context!, attrs: AttributeSet!, defStyleAttr: Int, defStyleRes: Int) Perform inflation from XML and apply a class-specific base style. |
|
<init>(context: Context!, attrs: AttributeSet!, defStyleAttr: Int) Perform inflation from XML and apply a class-specific base style. |
|
<init>(context: Context!, attrs: AttributeSet!) Constructor that is called when inflating a preference from XML. |
|
Constructor to create a preference. |
Public methods | |
---|---|
open Boolean |
callChangeListener(newValue: Any!) Call this method after the user changes the preference, but before the internal state is set. |
open Int |
compareTo(@NonNull other: Preference) Compares preference objects based on order (if set), otherwise alphabetically on the titles. |
open Context! |
Returns the |
open String! |
Returns the key of the dependency on this preference. |
open Bundle! |
Return the extras Bundle object associated with this preference, creating a new Bundle if there currently isn't one. |
open String! |
Return the fragment class name associated with this preference. |
open Drawable! |
getIcon() Returns the icon of this preference. |
open Intent! |
Return the |
open String! |
getKey() Gets the key for this preference, which is also the key used for storing values into |
Int |
Gets the layout resource that will be shown as the |
open Preference.OnPreferenceChangeListener! |
Returns the callback to be invoked when this preference is changed by the user (but before the internal state has been updated). |
open Preference.OnPreferenceClickListener! |
Returns the callback to be invoked when this preference is clicked. |
open Int |
getOrder() Gets the order of this preference with respect to other preference objects on the same level. |
open PreferenceGroup? |
Returns the |
open MutableSet<String!>! |
getPersistedStringSet(defaultReturnValue: MutableSet<String!>!) Attempts to get a persisted set of Strings if this preference is persistent. |
open PreferenceDataStore? |
Returns |
open PreferenceManager! |
Gets the |
open SharedPreferences! |
Returns the |
open Boolean |
Checks whether this preference should disable its view when it's action is disabled. |
open CharSequence! |
Returns the summary of this preference. |
Preference.SummaryProvider<Preference!>? |
Returns the |
open CharSequence! |
getTitle() Returns the title of this preference. |
Int |
Gets the layout resource for the controllable widget portion of this preference. |
open Boolean |
hasKey() Checks whether this preference has a valid key. |
open Boolean |
Returns whether the summary of this preference can be copied to the clipboard by long pressing on the preference. |
open Boolean |
Checks whether this preference should be enabled in the list. |
open Boolean |
Returns whether the space of this preference icon view is reserved. |
open Boolean |
Checks whether this preference is persistent. |
open Boolean |
Checks whether this preference should be selectable in the list. |
Boolean |
isShown() Checks whether this preference is shown to the user in the hierarchy. |
open Boolean |
Gets whether the title of this preference is constrained to a single line. |
Boolean |
Checks whether this preference should be visible to the user. |
open Unit |
notifyDependencyChange(disableDependents: Boolean) Notifies any listening dependents of a change that affects the dependency. |
open Unit |
Called when the preference hierarchy has been attached to the list of preferences. |
open Unit |
onBindViewHolder(holder: PreferenceViewHolder!) Binds the created View to the data for this preference. |
open Unit |
onDependencyChanged(dependency: Preference!, disableDependent: Boolean) Called when the dependency changes. |
open Unit |
Called when the preference hierarchy has been detached from the list of preferences. |
open Unit |
Initializes an |
open Unit |
onParentChanged(parent: Preference!, disableChild: Boolean) Called when the implicit parent dependency changes. |
open Bundle! |
Return the extras Bundle object associated with this preference, returning |
open |