PreferenceGroup | API reference | Android Developers
boolean
Call this method after the user changes the preference, but before the internal state is set.
int
Compares preference objects based on order (if set), otherwise alphabetically on the titles.
@Nullable T
Finds a preference in the entire hierarchy (above or below this preference) with the given key.
@NonNull Context
Returns the Context of this preference.
@Nullable String
Returns the key of the dependency on this preference.
@NonNull Bundle
Return the extras Bundle object associated with this preference, creating a new Bundle if there currently isn't one.
@Nullable String
Return the fragment class name associated with this preference.
@Nullable Drawable
Returns the icon of this preference.
@Nullable Intent
Return the Intent associated with this preference.
String
Gets the key for this preference, which is also the key used for storing values into SharedPreferences or PreferenceDataStore.
final int
Gets the layout resource that will be shown as the View for this preference.
@Nullable Preference.OnPreferenceChangeListener
Returns the callback to be invoked when this preference is changed by the user (but before the internal state has been updated).
@Nullable Preference.OnPreferenceClickListener
Returns the callback to be invoked when this preference is clicked.
int
Gets the order of this preference with respect to other preference objects on the same level.
@Nullable PreferenceGroup
Returns the PreferenceGroup which is this preference assigned to or null if this preference is not assigned to any group or is a root preference.
boolean
Attempts to get a persisted Boolean if this preference is persistent.
float
Attempts to get a persisted Float if this preference is persistent.
int
Attempts to get a persisted Integer if this preference is persistent.
long
Attempts to get a persisted Long if this preference is persistent.
String
Attempts to get a persisted set of Strings if this preference is persistent.
Set<String>
Attempts to get a persisted set of Strings if this preference is persistent.
@Nullable PreferenceDataStore
Returns PreferenceDataStore used by this preference.
PreferenceManager
Gets the PreferenceManager that manages this preference object's tree.
@Nullable SharedPreferences
Returns the SharedPreferences where this preference can read its value(s).
boolean
Checks whether this preference should disable its view when it's action is disabled.
@Nullable CharSequence
Returns the summary of this preference.
final @Nullable Preference.SummaryProvider
Returns the SummaryProvider used to configure the summary of this preference.
@Nullable CharSequence
Returns the title of this preference.
final int
Gets the layout resource for the controllable widget portion of this preference.
boolean
Checks whether this preference has a valid key.
boolean
Returns whether the summary of this preference can be copied to the clipboard by long pressing on the preference.
boolean
Checks whether this preference should be enabled in the list.
boolean
Returns whether the space of this preference icon view is reserved.
boolean
Checks whether this preference is persistent.
boolean
Checks whether this preference should be selectable in the list.
final boolean
Checks whether this preference is shown to the user in the hierarchy.
boolean
Gets whether the title of this preference is constrained to a single line.
final boolean
Checks whether this preference should be visible to the user.
void
Should be called when the data of this Preference has changed.
void
Should be called when a preference has been added/removed from this group, or the ordering should be re-evaluated.
void
Called when this preference has been attached to a preference hierarchy.
void
Binds the created View to the data for this preference.
void
Processes a click on the preference.
void
Called when the dependency changes.
@Nullable Object
Called when a preference is being inflated and the default value attribute needs to be read.
void
This method is deprecated.
Preferences aren't views.
void
Called when the implicit parent dependency changes.
void
Called when this preference is being removed from the hierarchy.
void
Implement this to set the initial value of the preference.
void
This method is deprecated.
Use onSetInitialValue instead.
@Nullable Bundle
Return the extras Bundle object associated with this preference, returning null if there is not currently one.
boolean
Attempts to persist a Boolean if this preference is persistent.
boolean
Attempts to persist a Float if this preference is persistent.
boolean
Attempts to persist an Integer if this preference is persistent.
boolean
Attempts to persist a Long if this preference is persistent.
boolean
Attempts to persist a String if this preference is persistent.
boolean
Attempts to persist a set of Strings if this preference is persistent.
void
Restore this preference hierarchy's previously saved state from the given container.
void
Store this preference hierarchy's frozen state into the given container.
void
Sets whether the summary of this preference can be copied to the clipboard by long pressing on the preference.
void
Sets the default value for this preference, which will be set either if persistence is off or persistence is on and the preference is not found in the persistent storage.
void
Sets the key of a preference that this preference will depend on.
void
Sets whether this preference is enabled.
void
Sets the class name of a fragment to be shown when this preference is clicked.
void
Sets the icon for this preference with a Drawable.
void
Sets the icon for this preference with a resource ID.
void
Sets whether to reserve the space of this preference icon view when no icon is provided.
void
Sets an Intent to be used for startActivity when this preference is clicked.
void
Sets the key for this preference, which is used as a key to the SharedPreferences or PreferenceDataStore.
void
Sets the layout resource that is inflated as the View to be shown for this preference.
void
Sets the callback to be invoked when this preference is changed by the user (but before the internal state has been updated).
void
Sets the callback to be invoked when this preference is clicked.
void
Sets the order of this preference with respect to other preference objects on the same level.
void
Sets whether this preference is persistent.
void
Sets a PreferenceDataStore to be used by this preference instead of using SharedPreferences.
void
Sets whether this preference is selectable.
void
Sets whether this preference should disable its view when it gets disabled.
void
Sets whether to constrain the title of this preference to a single line instead of letting it wrap onto multiple lines.
void
Sets the summary for this preference with a CharSequence.
void
Sets the summary for this preference with a resource ID.
final void
Set a SummaryProvider that will be invoked whenever the summary of this preference is requested.
void
Sets the title for this preference with a CharSequence.
void
Sets the title for this preference with a resource ID.
void
Set the ID that will be assigned to the overall View representing this preference, once bound.
final void
Sets whether this preference should be visible to the user.
void
Sets the layout for the controllable widget portion of this preference.
boolean
Checks whether this preference's dependents should currently be disabled.
boolean
Checks whether, at the given time this method is called, this preference should store/restore its value(s) into the SharedPreferences or into PreferenceDataStore if assigned.
@NonNull String