public interface ExpandableListAdapter
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
View
s for children and groups.Modifier and Type | Method and Description |
---|---|
boolean |
areAllItemsEnabled() |
Object |
getChild(int groupPosition,
int childPosition)
Gets the data associated with the given child within the given group.
|
long |
getChildId(int groupPosition,
int childPosition)
Gets the ID for the given child within the given group.
|
int |
getChildrenCount(int groupPosition)
Gets the number of children in a specified group.
|
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.
|
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.
|
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.
|
Object |
getGroup(int groupPosition)
Gets the data associated with the given group.
|
int |
getGroupCount()
Gets the number of groups.
|
long |
getGroupId(int groupPosition)
Gets the ID for the group at the given position.
|
View |
getGroupView(int groupPosition,
boolean isExpanded,
View convertView,
ViewGroup parent)
Gets a View that displays the given group.
|
boolean |
hasStableIds()
Indicates whether the child and group IDs are stable across changes to the
underlying data.
|
boolean |
isChildSelectable(int groupPosition,
int childPosition)
Whether the child at the specified position is selectable.
|
boolean |
isEmpty() |
void |
onGroupCollapsed(int groupPosition)
Called when a group is collapsed.
|
void |
onGroupExpanded(int groupPosition)
Called when a group is expanded.
|
void |
registerDataSetObserver(DataSetObserver observer) |
void |
unregisterDataSetObserver(DataSetObserver observer) |
void registerDataSetObserver(DataSetObserver observer)
void unregisterDataSetObserver(DataSetObserver observer)
int getGroupCount()
int getChildrenCount(int groupPosition)
groupPosition
- the position of the group for which the children
count should be returnedObject getGroup(int groupPosition)
groupPosition
- the position of the groupObject getChild(int groupPosition, int childPosition)
groupPosition
- the position of the group that the child resides inchildPosition
- the position of the child with respect to other
children in the grouplong getGroupId(int groupPosition)
getCombinedGroupId(long)
) must be unique across ALL items
(groups and all children).groupPosition
- the position of the group for which the ID is wantedlong getChildId(int groupPosition, int childPosition)
getCombinedChildId(long, long)
) must be unique across ALL items
(groups and all children).groupPosition
- the position of the group that contains the childchildPosition
- the position of the child within the group for which
the ID is wantedboolean hasStableIds()
Adapter.hasStableIds()
View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent)
getChildView(int, int, boolean, View, ViewGroup)
.groupPosition
- the position of the group for which the View is
returnedisExpanded
- whether the group is expanded or collapsedconvertView
- 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 toView getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent)
groupPosition
- the position of the group that contains the childchildPosition
- the position of the child (for which the View is
returned) within the groupisLastChild
- Whether the child is the last child within the groupconvertView
- 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 toboolean isChildSelectable(int groupPosition, int childPosition)
groupPosition
- the position of the group that contains the childchildPosition
- the position of the child within the groupboolean areAllItemsEnabled()
ListAdapter.areAllItemsEnabled()
boolean isEmpty()
Adapter.isEmpty()
void onGroupExpanded(int groupPosition)
groupPosition
- The group being expanded.void onGroupCollapsed(int groupPosition)
groupPosition
- The group being collapsed.long getCombinedChildId(long groupId, long childId)
hasStableIds()
is true, the
returned ID must be stable as well.groupId
- The ID of the group that contains this child.childId
- The ID of the child.long getCombinedGroupId(long groupId)
hasStableIds()
is true, the returned ID must be
stable as well.groupId
- The ID of the group