ExpandableListAdapter

interface 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.

Summary

Public methods
abstract Int
getChildrenCount(groupPosition: Int)

Gets the number of children in a specified group.

abstract Any!
getGroup(groupPosition: Int)

Gets the data associated with the given group.

abstract Unit
onGroupCollapsed(groupPosition: Int)

Called when a group is collapsed.

abstract Boolean

abstract Unit

abstract Any!
getChild(groupPosition: Int, childPosition: Int)

Gets the data associated with the given child within the given group.

abstract Unit
onGroupExpanded(groupPosition: Int)

Called when a group is expanded.

abstract Long
getCombinedChildId(groupId: Long, childId: Long)

Gets an ID for a child that is unique across any item (either group or child) that is in this list.

abstract Long
getGroupId(groupPosition: Int)

Gets the ID for the group at the given position.

abstract Boolean
isChildSelectable(groupPosition: Int, childPosition: Int)

Whether the child at the specified position is selectable.

abstract Boolean

Indicates whether the child and group IDs are stable across changes to the underlying data.

abstract View!
getChildView(groupPosition: Int, childPosition: Int, isLastChild: Boolean, convertView: View!, parent: ViewGroup!)

Gets a View that displays the data for the given child within the given group.

abstract Boolean

abstract Long
getChildId(groupPosition: Int, childPosition: Int)

Gets the ID for the given child within the given group.

abstract Long

Gets an ID for a group that is unique across any item (either group or child) that is in this list.

abstract View!
getGroupView(groupPosition: Int, isExpanded: Boolean, convertView: View!, parent: ViewGroup!)

Gets a View that displays the given group.

abstract Unit

abstract Int

Gets the number of groups.

Public methods

getChildrenCount

abstract fun getChildrenCount(groupPosition: Int): Int

Gets the number of children in a specified group.

Parameters
groupPosition Int: the position of the group for which the children count should be returned
Return
Int: the children count in the specified group

getGroup

abstract fun getGroup(groupPosition: Int): Any!

Gets the data associated with the given group.

Parameters
groupPosition Int: the position of the group
Return
Any!: the data child for the specified group

onGroupCollapsed

abstract fun onGroupCollapsed(groupPosition: Int): Unit

Called when a group is collapsed.

Parameters
groupPosition Int: The group being collapsed.

isEmpty

abstract fun isEmpty(): Boolean

registerDataSetObserver

abstract fun registerDataSetObserver(observer: DataSetObserver!): Unit

getChild

abstract fun getChild(groupPosition: Int, childPosition: Int): Any!

Gets the data associated with the given child within the given group.

Parameters
groupPosition Int: the position of the group that the child resides in
childPosition Int: the position of the child with respect to other children in the group
Return
Any!: the data of the child

onGroupExpanded

abstract fun onGroupExpanded(groupPosition: Int): Unit

Called when a group is expanded.

Parameters
groupPosition Int: The group being expanded.

getCombinedChildId

abstract fun getCombinedChildId(groupId: Long, childId: Long): Long

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 #hasStableIds() is true, the returned ID must be stable as well.

Parameters
groupId Long: The ID of the group that contains this child.
childId Long: The ID of the child.
Return
Long: The unique (and possibly stable) ID of the child across all groups and children in this list.

getGroupId

abstract fun getGroupId(groupPosition: Int): Long

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 Int: the position of the group for which the ID is wanted
Return
Long: the ID associated with the group

isChildSelectable

abstract fun isChildSelectable(groupPosition: Int, childPosition: Int): Boolean

Whether the child at the specified position is selectable.

Parameters
groupPosition Int: the position of the group that contains the child
childPosition Int: the position of the child within the group
Return
Boolean: whether the child is selectable.

hasStableIds

abstract fun hasStableIds(): Boolean

Indicates whether the child and group IDs are stable across changes to the underlying data.

Return
Boolean: whether or not the same ID always refers to the same object

getChildView

abstract fun getChildView(groupPosition: Int, childPosition: Int, isLastChild: Boolean, convertView: View!, parent: ViewGroup!): View!

Gets a View that displays the data for the given child within the given group.

Parameters
groupPosition Int: the position of the group that contains the child
childPosition Int: the position of the child (for which the View is returned) within the group
isLastChild Int: Whether the child is the last child within the group
convertView Int: 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 Int: the parent that this view will eventually be attached to
Return
View!: the View corresponding to the child at the specified position

areAllItemsEnabled

abstract fun areAllItemsEnabled(): Boolean

getChildId

abstract fun getChildId(groupPosition: Int, childPosition: Int): Long

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 Int: the position of the group that contains the child
childPosition Int: the position of the child within the group for which the ID is wanted
Return
Long: the ID associated with the child

getCombinedGroupId

abstract fun getCombinedGroupId(groupId: Long): Long

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 #hasStableIds() is true, the returned ID must be stable as well.

Parameters
groupId Long: The ID of the group
Return
Long: The unique (and possibly stable) ID of the group across all groups and children in this list.

getGroupView

abstract fun getGroupView(groupPosition: Int, isExpanded: Boolean, convertView: View!, parent: ViewGroup!): View!

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 #getChildView(int, int, boolean, View, ViewGroup).

Parameters
groupPosition Int: the position of the group for which the View is returned
isExpanded Int: whether the group is expanded or collapsed
convertView Int: 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 Int: the parent that this view will eventually be attached to
Return
View!: the View corresponding to the group at the specified position

unregisterDataSetObserver

abstract fun unregisterDataSetObserver(observer: DataSetObserver!): Unit

getGroupCount

abstract fun getGroupCount(): Int

Gets the number of groups.

Return
Int: the number of groups