PreferenceCategory


public class PreferenceCategory
extends PreferenceGroup

java.lang.Object
   ↳ android.preference.Preference
     ↳ android.preference.PreferenceGroup
       ↳ android.preference.PreferenceCategory


This class was deprecated in API level 29.
Use the AndroidX Preference Library for consistent behavior across all devices. For more information on using the AndroidX Preference Library see Settings.

Used to group Preference objects and provide a disabled title above the group.

Developer Guides

For information about building a settings UI with Preferences, read the Settings guide.

Summary

Inherited XML attributes

Inherited constants

Public constructors

PreferenceCategory(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
PreferenceCategory(Context context, AttributeSet attrs, int defStyleAttr)
PreferenceCategory(Context context, AttributeSet attrs)
PreferenceCategory(Context context)

Public methods

boolean isEnabled()

Checks whether this Preference should be enabled in the list.

boolean shouldDisableDependents()

Checks whether this preference's dependents should currently be disabled.

Protected methods

boolean onPrepareAddPreference(Preference preference)

Prepares a Preference to be added to the group.

Inherited methods

Public constructors

PreferenceCategory

Added in API level 21
public PreferenceCategory (Context context, 
                AttributeSet attrs, 
                int defStyleAttr, 
                int defStyleRes)

Parameters
context Context

attrs AttributeSet

defStyleAttr int

defStyleRes int

PreferenceCategory

Added in API level 1
public PreferenceCategory (Context context, 
                AttributeSet attrs, 
                int defStyleAttr)

Parameters
context Context

attrs AttributeSet

defStyleAttr int

PreferenceCategory

Added in API level 1
public PreferenceCategory (Context context, 
                AttributeSet attrs)

Parameters
context Context

attrs AttributeSet

PreferenceCategory

Added in API level 1
public PreferenceCategory (Context context)

Parameters
context Context

Public methods

isEnabled

Added in API level 1
public boolean isEnabled ()

Checks whether this Preference should be enabled in the list.

Returns
boolean true if this Preference is enabled, false otherwise

shouldDisableDependents

Added in API level 1
public boolean shouldDisableDependents ()

Checks whether this preference's dependents should currently be disabled.

Returns
boolean True if the dependents should be disabled, otherwise false.

Protected methods

onPrepareAddPreference

Added in API level 1
protected boolean onPrepareAddPreference (Preference preference)

Prepares a Preference to be added to the group.

Parameters
preference Preference: The preference to add.

Returns
boolean Whether to allow adding the preference (true), or not (false).