Added in API level 1

SimpleExpandableListAdapter


open class SimpleExpandableListAdapter : BaseExpandableListAdapter
kotlin.Any
   ↳ android.widget.BaseExpandableListAdapter
   ↳ android.widget.SimpleExpandableListAdapter

An easy adapter to map static data to group and child views defined in an XML file. You can separately specify the data backing the group as a List of Maps. Each entry in the ArrayList corresponds to one group in the expandable list. The Maps contain the data for each row. You also specify an XML file that defines the views used to display a group, and a mapping from keys in the Map to specific views. This process is similar for a child, except it is one-level deeper so the data backing is specified as a List>, where the first List corresponds to the group of the child, the second List corresponds to the position of the child within the group, and finally the Map holds the data for that particular child.

Summary

Public constructors
SimpleExpandableListAdapter(context: Context!, groupData: MutableList<out MutableMap<String!, *>!>!, groupLayout: Int, groupFrom: Array<String!>!, groupTo: IntArray!, childData: MutableList<out MutableList<out MutableMap<String!, *>!>!>!, childLayout: Int, childFrom: Array<String!>!, childTo: IntArray!)

Constructor

SimpleExpandableListAdapter(context: Context!, groupData: MutableList<out MutableMap<String!, *>!>!, expandedGroupLayout: Int, collapsedGroupLayout: Int, groupFrom: Array<String!>!, groupTo: IntArray!, childData: MutableList<out MutableList<out MutableMap<String!, *>!>!>!, childLayout: Int, childFrom: Array<String!>!, childTo: IntArray!)

Constructor

SimpleExpandableListAdapter(context: Context!, groupData: MutableList<out MutableMap<String!, *>!>!, expandedGroupLayout: Int, collapsedGroupLayout: Int, groupFrom: Array<String!>!, groupTo: IntArray!, childData: MutableList<out MutableList<out MutableMap<String!, *>!>!>!, childLayout: Int, lastChildLayout: Int, childFrom: Array<String!>!, childTo: IntArray!)

Constructor

Public methods
open Any!
getChild(groupPosition: Int, childPosition: Int)

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

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

open Int
getChildrenCount(groupPosition: Int)

open Any!
getGroup(groupPosition: Int)

open Int

open Long
getGroupId(groupPosition: Int)

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

open Boolean

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

open View!
newChildView(isLastChild: Boolean, parent: ViewGroup!)

Instantiates a new View for a child.

open View!
newGroupView(isExpanded: Boolean, parent: ViewGroup!)

Instantiates a new View for a group.

Inherited functions

Public constructors

SimpleExpandableListAdapter

Added in API level 1
SimpleExpandableListAdapter(
    context: Context!,
    groupData: MutableList<out MutableMap<String!, *>!>!,
    groupLayout: Int,
    groupFrom: Array<String!>!,
    groupTo: IntArray!,
    childData: MutableList<out MutableList<out MutableMap<String!, *>!>!>!,
    childLayout: Int,
    childFrom: Array<String!>!,
    childTo: IntArray!)

Constructor

Parameters
context Context!: The context where the ExpandableListView associated with this SimpleExpandableListAdapter is running
groupData MutableList<out MutableMap<String!, *>!>!: A List of Maps. Each entry in the List corresponds to one group in the list. The Maps contain the data for each group, and should include all the entries specified in "groupFrom"
groupFrom Array<String!>!: A list of keys that will be fetched from the Map associated with each group.
groupTo IntArray!: The group views that should display column in the "groupFrom" parameter. These should all be TextViews. The first N views in this list are given the values of the first N columns in the groupFrom parameter.
groupLayout Int: resource identifier of a view layout that defines the views for a group. The layout file should include at least those named views defined in "groupTo"
childData MutableList<out MutableList<out MutableMap<String!, *>!>!>!: A List of List of Maps. Each entry in the outer List corresponds to a group (index by group position), each entry in the inner List corresponds to a child within the group (index by child position), and the Map corresponds to the data for a child (index by values in the childFrom array). The Map contains the data for each child, and should include all the entries specified in "childFrom"
childFrom Array<String!>!: A list of keys that will be fetched from the Map associated with each child.
childTo IntArray!: The child views that should display column in the "childFrom" parameter. These should all be TextViews. The first N views in this list are given the values of the first N columns in the childFrom parameter.
childLayout Int: resource identifier of a view layout that defines the views for a child. The layout file should include at least those named views defined in "childTo"

SimpleExpandableListAdapter

Added in API level 1
SimpleExpandableListAdapter(
    context: Context!,
    groupData: MutableList<out MutableMap<String!, *>!>!,
    expandedGroupLayout: Int,
    collapsedGroupLayout: Int,
    groupFrom: Array<String!>!,
    groupTo: IntArray!,
    childData: MutableList<out MutableList<out MutableMap<String!, *>!>!>!,
    childLayout: Int,
    childFrom: Array<String!>!,
    childTo: IntArray!)

Constructor

Parameters
context Context!: The context where the ExpandableListView associated with this SimpleExpandableListAdapter is running
groupData MutableList<out MutableMap<String!, *>!>!: A List of Maps. Each entry in the List corresponds to one group in the list. The Maps contain the data for each group, and should include all the entries specified in "groupFrom"
groupFrom Array<String!>!: A list of keys that will be fetched from the Map associated with each group.
groupTo IntArray!: The group views that should display column in the "groupFrom" parameter. These should all be TextViews. The first N views in this list are given the values of the first N columns in the groupFrom parameter.
expandedGroupLayout Int: resource identifier of a view layout that defines the views for an expanded group. The layout file should include at least those named views defined in "groupTo"
collapsedGroupLayout Int: resource identifier of a view layout that defines the views for a collapsed group. The layout file should include at least those named views defined in "groupTo"
childData MutableList<out MutableList<out MutableMap<String!, *>!>!>!: A List of List of Maps. Each entry in the outer List corresponds to a group (index by group position), each entry in the inner List corresponds to a child within the group (index by child position), and the Map corresponds to the data for a child (index by values in the childFrom array). The Map contains the data for each child, and should include all the entries specified in "childFrom"
childFrom Array<String!>!: A list of keys that will be fetched from the Map associated with each child.
childTo IntArray!: The child views that should display column in the "childFrom" parameter. These should all be TextViews. The first N views in this list are given the values of the first N columns in the childFrom parameter.
childLayout Int: resource identifier of a view layout that defines the views for a child. The layout file should include at least those named views defined in "childTo"

SimpleExpandableListAdapter

Added in API level 1
SimpleExpandableListAdapter(
    context: Context!,
    groupData: MutableList<out MutableMap<String!, *>!>!,
    expandedGroupLayout: Int,
    collapsedGroupLayout: Int,
    groupFrom: Array<String!>!,
    groupTo: IntArray!,
    childData: MutableList<out MutableList<out MutableMap<String!, *>!>!>!,
    childLayout: Int,
    lastChildLayout: Int,
    childFrom: Array<String!>!,
    childTo: IntArray!)

Constructor

Parameters
context Context!: The context where the ExpandableListView associated with this SimpleExpandableListAdapter is running
groupData MutableList<out MutableMap<String!, *>!>!: A List of Maps. Each entry in the List corresponds to one group in the list. The Maps contain the data for each group, and should include all the entries specified in "groupFrom"
groupFrom Array<String!>!: A list of keys that will be fetched from the Map associated with each group.
groupTo IntArray!: The group views that should display column in the "groupFrom" parameter. These should all be TextViews. The first N views in this list are given the values of the first N columns in the groupFrom parameter.
expandedGroupLayout Int: resource identifier of a view layout that defines the views for an expanded group. The layout file should include at least those named views defined in "groupTo"
collapsedGroupLayout Int: resource identifier of a view layout that defines the views for a collapsed group. The layout file should include at least those named views defined in "groupTo"
childData MutableList<out MutableList<out MutableMap<String!, *>!>!>!: A List of List of Maps. Each entry in the outer List corresponds to a group (index by group position), each entry in the inner List corresponds to a child within the group (index by child position), and the Map corresponds to the data for a child (index by values in the childFrom array). The Map contains the data for each child, and should include all the entries specified in "childFrom"
childFrom Array<String!>!: A list of keys that will be fetched from the Map associated with each child.
childTo IntArray!: The child views that should display column in the "childFrom" parameter. These should all be TextViews. The first N views in this list are given the values of the first N columns in the childFrom parameter.
childLayout Int: resource identifier of a view layout that defines the views for a child (unless it is the last child within a group, in which case the lastChildLayout is used). The layout file should include at least those named views defined in "childTo"
lastChildLayout Int: resource identifier of a view layout that defines the views for the last child within each group. The layout file should include at least those named views defined in "childTo"

Public methods

getChild

Added in API level 1
open fun getChild(
    groupPosition: Int,
    childPosition: Int
): Any!
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

getChildId

Added in API level 1
open fun getChildId(
    groupPosition: Int,
    childPosition: Int
): Long
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

getChildView

Added in API level 1
open fun getChildView(
    groupPosition: Int,
    childPosition: Int,
    isLastChild: Boolean,
    convertView: View!,
    parent: ViewGroup!
): View!
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 Boolean: Whether the child is the last child within the group
convertView View!: 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,android.view.View,android.view.ViewGroup).
parent ViewGroup!: the parent that this view will eventually be attached to
Return
View! the View corresponding to the child at the specified position

getChildrenCount

Added in API level 1
open fun getChildrenCount(groupPosition: Int): Int
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

Added in API level 1
open fun getGroup(groupPosition: Int): Any!
Parameters
groupPosition Int: the position of the group
Return
Any! the data child for the specified group

getGroupCount

Added in API level 1
open fun getGroupCount(): Int
Return
Int the number of groups

getGroupId

Added in API level 1
open fun getGroupId(groupPosition: Int): Long
Parameters
groupPosition Int: the position of the group for which the ID is wanted
Return
Long the ID associated with the group

getGroupView

Added in API level 1
open fun getGroupView(
    groupPosition: Int,
    isExpanded: Boolean,
    convertView: View!,
    parent: ViewGroup!
): View!
Parameters
groupPosition Int: the position of the group for which the View is returned
isExpanded Boolean: whether the group is expanded or collapsed
convertView View!: 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,android.view.View,android.view.ViewGroup).
parent ViewGroup!: the parent that this view will eventually be attached to
Return
View! the View corresponding to the group at the specified position

hasStableIds

Added in API level 1
open fun hasStableIds(): Boolean
Return
Boolean whether or not the same ID always refers to the same object

isChildSelectable

Added in API level 1
open fun isChildSelectable(
    groupPosition: Int,
    childPosition: Int
): Boolean
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.

newChildView

Added in API level 1
open fun newChildView(
    isLastChild: Boolean,
    parent: ViewGroup!
): View!

Instantiates a new View for a child.

Parameters
isLastChild Boolean: Whether the child is the last child within its group.
parent ViewGroup!: The eventual parent of this new View.
Return
View! A new child View

newGroupView

Added in API level 1
open fun newGroupView(
    isExpanded: Boolean,
    parent: ViewGroup!
): View!

Instantiates a new View for a group.

Parameters
isExpanded Boolean: Whether the group is currently expanded.
parent ViewGroup!: The eventual parent of this new View.
Return
View! A new group View