java.lang.Object | ||
↳ | android.preference.Preference | |
↳ | android.preference.PreferenceGroup |
Known Direct Subclasses |
A container for multiple
Preference
objects. It is a base class for Preference objects that are
parents, such as PreferenceCategory
and PreferenceScreen
.
For information about building a settings UI with Preferences, read the Settings guide.
XML Attributes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
android:orderingFromXml | Whether to order the Preference under this group as they appear in the XML file. |
[Expand]
Inherited XML Attributes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.preference.Preference
|
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.preference.Preference
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Called by the inflater to add an item to this group.
| |||||||||||
Adds a
Preference at the correct position based on the
preference's order. | |||||||||||
Finds a
Preference based on its key. | |||||||||||
Returns the
Preference at a particular index. | |||||||||||
Returns the number of children
Preference s. | |||||||||||
Whether this group is ordering preferences in the order they are added.
| |||||||||||
Notifies any listening dependents of a change that affects the
dependency.
| |||||||||||
Removes all
Preferences from this group. | |||||||||||
Removes a
Preference from this group. | |||||||||||
Whether to order the
Preference children of this group as they
are added. |
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Called by
restoreHierarchyState(Bundle) to retrieve the saved state for this
Preference and its children. | |||||||||||
Called by
saveHierarchyState(Bundle) to store the instance for this Preference and its children. | |||||||||||
Whether this preference group should be shown on the same screen as its
contained preferences.
| |||||||||||
Called when the Preference hierarchy has been attached to the
PreferenceActivity . | |||||||||||
Prepares a
Preference to be added to the group. | |||||||||||
Called when this Preference is being removed from the hierarchy.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.preference.Preference
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
java.lang.Comparable
|
Whether to order the Preference under this group as they appear in the XML file. If this is false, the ordering will follow the Preference order attribute and default to alphabetic for those without the order attribute.
Must be a boolean value, either "true
" or "false
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute
resource symbol orderingFromXml
.
Called by the inflater to add an item to this group.
Adds a Preference
at the correct position based on the
preference's order.
preference | The preference to add. |
---|
Finds a Preference
based on its key. If two Preference
share the same key (not recommended), the first to appear will be
returned (to retrieve the other preference with the same key, call this
method on the first preference). If this preference has the key, it will
not be returned.
This will recursively search for the preference into children that are
also PreferenceGroups
.
key | The key of the preference to retrieve. |
---|
Preference
with the key, or null.
Returns the Preference
at a particular index.
index | The index of the Preference to retrieve. |
---|
Preference
.
Returns the number of children Preference
s.
Whether this group is ordering preferences in the order they are added.
Notifies any listening dependents of a change that affects the dependency.
disableDependents | Whether this Preference should disable its dependents. |
---|
Removes a Preference
from this group.
preference | The preference to remove. |
---|
Whether to order the Preference
children of this group as they
are added. If this is false, the ordering will follow each Preference
order and default to alphabetic for those without an order.
If this is called after preferences are added, they will not be re-ordered in the order they were added, hence call this method early on.
orderingAsAdded | Whether to order according to the order added. |
---|
Called by restoreHierarchyState(Bundle)
to retrieve the saved state for this
Preference and its children. May be overridden to modify how restoring
happens to the children of a Preference. For example, some Preference objects may
not want to save state for their children.
container | The Bundle that holds the previously saved state. |
---|
Called by saveHierarchyState(Bundle)
to store the instance for this Preference and its children.
May be overridden to modify how the save happens for children. For example, some
Preference objects may want to not store an instance for their children.
container | The Bundle in which to save the instance of this Preference. |
---|
Whether this preference group should be shown on the same screen as its contained preferences.
Called when the Preference hierarchy has been attached to the
PreferenceActivity
. This can also be called when this
Preference has been attached to a group that was already attached
to the PreferenceActivity
.
Prepares a Preference
to be added to the group.
preference | The preference to add. |
---|
Called when this Preference is being removed from the hierarchy. You should remove any references to this Preference that you know about. Make sure to call through to the superclass implementation.