BaseExpandableListAdapter
abstract class BaseExpandableListAdapter : ExpandableListAdapter, HeterogeneousExpandableList
kotlin.Any | |
↳ | android.widget.BaseExpandableListAdapter |
Base class for a ExpandableListAdapter
used to provide data and Views from some data to an expandable list view.
Adapters inheriting this class should verify that the base implementations of getCombinedChildId(long,long)
and getCombinedGroupId(long)
are correct in generating unique IDs from the group/children IDs.
Summary
Public constructors | |
---|---|
Public methods | |
---|---|
open Boolean | |
open Int |
getChildType(groupPosition: Int, childPosition: Int) Get the type of child View that will be created by |
open Int |
Returns the number of types of child Views that will be created by |
open Long |
getCombinedChildId(groupId: Long, childId: Long) Override this method if you foresee a clash in IDs based on this scheme: |
open Long |
getCombinedGroupId(groupId: Long) Override this method if you foresee a clash in IDs based on this scheme: |
open Int |
getGroupType(groupPosition: Int) Get the type of group View that will be created by |
open Int |
Returns the number of types of group Views that will be created by |
open Boolean |
isEmpty() |
open Unit | |
open Unit | |
open Unit |
onGroupCollapsed(groupPosition: Int) |
open Unit |
onGroupExpanded(groupPosition: Int) |
open Unit |
registerDataSetObserver(observer: DataSetObserver!) |
open Unit |
unregisterDataSetObserver(observer: DataSetObserver!) |
Inherited functions | |
---|---|
Public constructors
BaseExpandableListAdapter
BaseExpandableListAdapter()
Public methods
getChildType
open fun getChildType(
groupPosition: Int,
childPosition: Int
): Int
Get the type of child View that will be created by android.widget.ExpandableListAdapter#getChildView(int, int, boolean, View, ViewGroup)
for the specified child item.
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 | |
---|---|
Int |
0 for any group or child position, since only one child type count is declared. |
getChildTypeCount
open fun getChildTypeCount(): Int
Returns the number of types of child Views that will be created by android.widget.ExpandableListAdapter#getChildView(int, int, boolean, View, ViewGroup)
. Each type represents a set of views that can be converted in android.widget.ExpandableListAdapter#getChildView(int, int, boolean, View, ViewGroup)
, for any group. If the adapter always returns the same type of View for all child items, this method should return 1.
AdapterView
.
Return | |
---|---|
Int |
1 as a default value in BaseExpandableListAdapter. |
getCombinedChildId
open fun getCombinedChildId(
groupId: Long,
childId: Long
): Long
Override this method if you foresee a clash in IDs based on this scheme:
Base implementation returns a 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. |
getCombinedGroupId
open fun getCombinedGroupId(groupId: Long): Long
Override this method if you foresee a clash in IDs based on this scheme:
Base implementation returns a 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. |
getGroupType
open fun getGroupType(groupPosition: Int): Int
Get the type of group View that will be created by android.widget.ExpandableListAdapter#getGroupView(int, boolean, View, ViewGroup)
. for the specified group item.
Parameters | |
---|---|
groupPosition |
Int: the position of the group for which the type should be returned. |
Return | |
---|---|
Int |
0 for any groupPosition, since only one group type count is declared. |
getGroupTypeCount
open fun getGroupTypeCount(): Int
Returns the number of types of group Views that will be created by android.widget.ExpandableListAdapter#getGroupView(int, boolean, View, ViewGroup)
. Each type represents a set of views that can be converted in android.widget.ExpandableListAdapter#getGroupView(int, boolean, View, ViewGroup)
. If the adapter always returns the same type of View for all group items, this method should return 1.
AdapterView
.
Return | |
---|---|
Int |
1 as a default value in BaseExpandableListAdapter. |
onGroupCollapsed
open fun onGroupCollapsed(groupPosition: Int): Unit
Parameters | |
---|---|
groupPosition |
Int: The group being collapsed. |
onGroupExpanded
open fun onGroupExpanded(groupPosition: Int): Unit
Parameters | |
---|---|
groupPosition |
Int: The group being expanded. |
registerDataSetObserver
open fun registerDataSetObserver(observer: DataSetObserver!): Unit
unregisterDataSetObserver
open fun unregisterDataSetObserver(observer: DataSetObserver!): Unit