android.widget
public
interface
android.widget.ExpandableListAdapter
| android.widget.ExpandableListAdapter |
|
An adapter that links a ExpandableListView with the underlying
data. The implementation of this interface will provide access
to the data of the children (categorized by groups), and also instantiate
Views for children and groups.
Known Indirect Subclasses
Summary
Public Methods
| |
|
|
|
boolean |
areAllItemsSelectable() |
| |
|
|
|
Object |
getChild(int groupPosition, int childPosition) |
| |
|
|
|
long |
getChildId(int groupPosition, int childPosition) |
| |
|
|
|
View |
getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) |
| |
|
|
|
int |
getChildrenCount(int groupPosition) |
| |
|
|
|
long |
getCombinedChildId(long groupId, long childId) |
| |
|
|
|
long |
getCombinedGroupId(long groupId) |
| |
|
|
|
Object |
getGroup(int groupPosition) |
| |
|
|
|
int |
getGroupCount() |
| |
|
|
|
long |
getGroupId(int groupPosition) |
| |
|
|
|
View |
getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) |
| |
|
|
|
long |
getNewSelectionForKey(long packedPosition, int keyCode, KeyEvent event) |
| |
|
|
|
boolean |
isChildSelectable(int groupPosition, int childPosition) |
| |
|
|
|
void |
onGroupCollapsed(int groupPosition) |
| |
|
|
|
void |
onGroupExpanded(int groupPosition) |
| |
|
|
|
void |
registerDataSetObserver(DataSetObserver observer) |
| |
|
|
|
boolean |
stableIds() |
| |
|
|
|
void |
unregisterDataSetObserver(DataSetObserver observer) |
Details
Public Methods
public
boolean
areAllItemsSelectable()
Are all items in this ExpandableListAdapter selectable?
Returns
- True if all items are selectable.
public
Object
getChild(int groupPosition, int childPosition)
Gets the data associated with the given child within the given group.
Parameters
| groupPosition
| the position of the group that the child resides in |
| childPosition
| the position of the child with respect to other
children in the group |
public
long
getChildId(int groupPosition, int childPosition)
Gets the ID for the given child within the given group. This ID must be
unique across all children within the group. The combined ID (see
getCombinedChildId(long, long)) must be unique across ALL items
(groups and all children).
Parameters
| groupPosition
| the position of the group that contains the child |
| childPosition
| the position of the child within the group for which
the ID is wanted |
Returns
- the ID associated with the child
public
View
getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent)
Gets a View that displays the data for the given child within the given
group.
Parameters
| groupPosition
| the position of the group that contains the child |
| childPosition
| the position of the child (for which the View is
returned) within the group |
| isLastChild
| Whether the child is the last child within the group |
| convertView
| the old view to reuse, if possible. You should check
that this view is non-null and of an appropriate type before
using. If it is not possible to convert this view to display
the correct data, this method can create a new view. It is not
guaranteed that the convertView will have been previously
created by
getChildView(int, int, boolean, View, ViewGroup). |
| parent
| the parent that this view will eventually be attached to |
Returns
- the View corresponding to the child at the specified position
public
int
getChildrenCount(int groupPosition)
Gets the number of children in a specified group.
Parameters
| groupPosition
| the position of the group for which the children
count should be returned |
Returns
- the children count in the specified group
public
long
getCombinedChildId(long groupId, long childId)
Gets an ID for a child that is unique across any item (either group or
child) that is in this list. Expandable lists require each item (group or
child) to have a unique ID among all children and groups in the list.
This method is responsible for returning that unique ID given a child's
ID and its group's ID. Furthermore, if
stableIds() is true, the
returned ID must be stable as well.
Parameters
| groupId
| The ID of the group that contains this child. |
| childId
| The ID of the child. |
Returns
- The unique (and possibly stable) ID of the child across all
groups and children in this list.
public
long
getCombinedGroupId(long groupId)
Gets an ID for a group that is unique across any item (either group or
child) that is in this list. Expandable lists require each item (group or
child) to have a unique ID among all children and groups in the list.
This method is responsible for returning that unique ID given a group's
ID. Furthermore, if
stableIds() is true, the returned ID must be
stable as well.
Parameters
| groupId
| The ID of the group |
Returns
- The unique (and possibly stable) ID of the group across all
groups and children in this list.
public
Object
getGroup(int groupPosition)
Gets the data associated with the given group.
Parameters
| groupPosition
| the position of the group |
Returns
- the data child for the specified group
public
int
getGroupCount()
Gets the number of groups.
public
long
getGroupId(int groupPosition)
Gets the ID for the group at the given position. This group ID must be
unique across groups. The combined ID (see
getCombinedGroupId(long)) must be unique across ALL items
(groups and all children).
Parameters
| groupPosition
| the position of the group for which the ID is wanted |
Returns
- the ID associated with the group
public
View
getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent)
Gets a View that displays the given group. This View is only for the
group--the Views for the group's children will be fetched using
getChildrenView.
Parameters
| groupPosition
| the position of the group for which the View is
returned |
| isExpanded
| whether the group is expanded or collapsed |
| convertView
| the old view to reuse, if possible. You should check
that this view is non-null and of an appropriate type before
using. If it is not possible to convert this view to display
the correct data, this method can create a new view. It is not
guaranteed that the convertView will have been previously
created by
getGroupView(int, boolean, View, ViewGroup). |
| parent
| the parent that this view will eventually be attached to |
Returns
- the View corresponding to the group at the specified position
public
long
getNewSelectionForKey(long packedPosition, int keyCode, KeyEvent event)
Given a keyboard key, let the adapter suggest the group/child to be made
the new selected child. Return
PACKED_POSITION_VALUE_NULL to indicate no
appropriate key (for example, the user pressed the back button, or a
subclass does not support this feature) or for no preference.
Parameters
| packedPosition
| the packed position of the currently selected child |
| keyCode
| the keyCode for the event |
| event
| the full key event structure |
Returns
- the new selection's position
public
boolean
isChildSelectable(int groupPosition, int childPosition)
Whether the child at the specified position is selectable.
Parameters
| groupPosition
| the position of the group that contains the child |
| childPosition
| the position of the child within the group |
Returns
- whether the child is selectable.
public
void
onGroupCollapsed(int groupPosition)
Called when a group is being collapsed.
Parameters
| groupPosition
| The group being collapsed.
|
public
void
onGroupExpanded(int groupPosition)
Called when a group is being expanded.
Parameters
| groupPosition
| The group being expanded.
|
public
void
registerDataSetObserver(DataSetObserver observer)
Register an observer that is called when changes happen to the data used
by this adapter.
Parameters
| observer
| the object that gets notified when the data set changes.
|
public
boolean
stableIds()
Indicates whether the child and group IDs are stable across changes to the
underlying data.
Returns
- whether or not the same ID always refers to the same object