Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Methods](https://developer.android.com/reference/android/widget/ExpandableListAdapter#pubmethods)

# ExpandableListAdapter

*** ** * ** ***

` public interface ExpandableListAdapter `   
` `

|---|
| android.widget.ExpandableListAdapter |

Known indirect subclasses [BaseExpandableListAdapter](https://developer.android.com/reference/android/widget/BaseExpandableListAdapter), [CursorTreeAdapter](https://developer.android.com/reference/android/widget/CursorTreeAdapter), [ResourceCursorTreeAdapter](https://developer.android.com/reference/android/widget/ResourceCursorTreeAdapter), [SimpleCursorTreeAdapter](https://developer.android.com/reference/android/widget/SimpleCursorTreeAdapter), [SimpleExpandableListAdapter](https://developer.android.com/reference/android/widget/SimpleExpandableListAdapter) [BaseExpandableListAdapter](https://developer.android.com/reference/android/widget/BaseExpandableListAdapter) Base class for a `https://developer.android.com/reference/android/widget/ExpandableListAdapter` used to provide data and Views from some data to an expandable list view. [CursorTreeAdapter](https://developer.android.com/reference/android/widget/CursorTreeAdapter) An adapter that exposes data from a series of `https://developer.android.com/reference/android/database/Cursor`s to an `https://developer.android.com/reference/android/widget/ExpandableListView` widget. [ResourceCursorTreeAdapter](https://developer.android.com/reference/android/widget/ResourceCursorTreeAdapter) A fairly simple ExpandableListAdapter that creates views defined in an XML file. [SimpleCursorTreeAdapter](https://developer.android.com/reference/android/widget/SimpleCursorTreeAdapter) An easy adapter to map columns from a cursor to TextViews or ImageViews defined in an XML file. [SimpleExpandableListAdapter](https://developer.android.com/reference/android/widget/SimpleExpandableListAdapter) An easy adapter to map static data to group and child views defined in an XML file.   

*** ** * ** ***

An adapter that links a `https://developer.android.com/reference/android/widget/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 `https://developer.android.com/reference/android/view/View`s for children and groups.

## Summary

| ### Public methods ||
|---|---|
| ` abstract boolean` | ` https://developer.android.com/reference/android/widget/ExpandableListAdapter#areAllItemsEnabled()() ` |
| ` abstract https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/android/widget/ExpandableListAdapter#getChild(int,%20int)(int groupPosition, int childPosition) ` Gets the data associated with the given child within the given group. |
| ` abstract long` | ` https://developer.android.com/reference/android/widget/ExpandableListAdapter#getChildId(int,%20int)(int groupPosition, int childPosition) ` Gets the ID for the given child within the given group. |
| ` abstract https://developer.android.com/reference/android/view/View` | ` https://developer.android.com/reference/android/widget/ExpandableListAdapter#getChildView(int,%20int,%20boolean,%20android.view.View,%20android.view.ViewGroup)(int groupPosition, int childPosition, boolean isLastChild, https://developer.android.com/reference/android/view/View convertView, https://developer.android.com/reference/android/view/ViewGroup parent) ` Gets a View that displays the data for the given child within the given group. |
| ` abstract int` | ` https://developer.android.com/reference/android/widget/ExpandableListAdapter#getChildrenCount(int)(int groupPosition) ` Gets the number of children in a specified group. |
| ` abstract long` | ` https://developer.android.com/reference/android/widget/ExpandableListAdapter#getCombinedChildId(long,%20long)(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. |
| ` abstract long` | ` https://developer.android.com/reference/android/widget/ExpandableListAdapter#getCombinedGroupId(long)(long groupId) ` Gets an ID for a group that is unique across any item (either group or child) that is in this list. |
| ` abstract https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/android/widget/ExpandableListAdapter#getGroup(int)(int groupPosition) ` Gets the data associated with the given group. |
| ` abstract int` | ` https://developer.android.com/reference/android/widget/ExpandableListAdapter#getGroupCount()() ` Gets the number of groups. |
| ` abstract long` | ` https://developer.android.com/reference/android/widget/ExpandableListAdapter#getGroupId(int)(int groupPosition) ` Gets the ID for the group at the given position. |
| ` abstract https://developer.android.com/reference/android/view/View` | ` https://developer.android.com/reference/android/widget/ExpandableListAdapter#getGroupView(int,%20boolean,%20android.view.View,%20android.view.ViewGroup)(int groupPosition, boolean isExpanded, https://developer.android.com/reference/android/view/View convertView, https://developer.android.com/reference/android/view/ViewGroup parent) ` Gets a View that displays the given group. |
| ` abstract boolean` | ` https://developer.android.com/reference/android/widget/ExpandableListAdapter#hasStableIds()() ` Indicates whether the child and group IDs are stable across changes to the underlying data. |
| ` abstract boolean` | ` https://developer.android.com/reference/android/widget/ExpandableListAdapter#isChildSelectable(int,%20int)(int groupPosition, int childPosition) ` Whether the child at the specified position is selectable. |
| ` abstract boolean` | ` https://developer.android.com/reference/android/widget/ExpandableListAdapter#isEmpty()() ` |
| ` abstract void` | ` https://developer.android.com/reference/android/widget/ExpandableListAdapter#onGroupCollapsed(int)(int groupPosition) ` Called when a group is collapsed. |
| ` abstract void` | ` https://developer.android.com/reference/android/widget/ExpandableListAdapter#onGroupExpanded(int)(int groupPosition) ` Called when a group is expanded. |
| ` abstract void` | ` https://developer.android.com/reference/android/widget/ExpandableListAdapter#registerDataSetObserver(android.database.DataSetObserver)(https://developer.android.com/reference/android/database/DataSetObserver observer) ` |
| ` abstract void` | ` https://developer.android.com/reference/android/widget/ExpandableListAdapter#unregisterDataSetObserver(android.database.DataSetObserver)(https://developer.android.com/reference/android/database/DataSetObserver observer) ` |

## Public methods

### areAllItemsEnabled

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract boolean areAllItemsEnabled ()
```

<br />

<br />

| Returns ||
|---|---|
| `boolean` | <br /> |

**See also:**

- `https://developer.android.com/reference/android/widget/ListAdapter#areAllItemsEnabled()`

### getChild

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract Object getChild (int groupPosition, 
                int childPosition)
```

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

<br />

| Parameters ||
|---|---|
| `groupPosition` | `int`: the position of the group that the child resides in <br /> |
| `childPosition` | `int`: the position of the child with respect to other children in the group <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/Object` | the data of the child <br /> |

### getChildId

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract 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 `https://developer.android.com/reference/android/widget/ExpandableListAdapter#getCombinedChildId(long,%20long)`) must be unique across ALL items (groups and all children).

<br />

| Parameters ||
|---|---|
| `groupPosition` | `int`: the position of the group that contains the child <br /> |
| `childPosition` | `int`: the position of the child within the group for which the ID is wanted <br /> |

| Returns ||
|---|---|
| `long` | the ID associated with the child <br /> |

### getChildView

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract 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.

<br />

| Parameters ||
|---|---|
| `groupPosition` | `int`: the position of the group that contains the child <br /> |
| `childPosition` | `int`: the position of the child (for which the View is returned) within the group <br /> |
| `isLastChild` | `boolean`: Whether the child is the last child within the group <br /> |
| `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 `https://developer.android.com/reference/android/widget/ExpandableListAdapter#getChildView(int,%20int,%20boolean,%20android.view.View,%20android.view.ViewGroup)`. <br /> |
| `parent` | `ViewGroup`: the parent that this view will eventually be attached to <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/View` | the View corresponding to the child at the specified position <br /> |

### getChildrenCount

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract int getChildrenCount (int groupPosition)
```

Gets the number of children in a specified group.

<br />

| Parameters ||
|---|---|
| `groupPosition` | `int`: the position of the group for which the children count should be returned <br /> |

| Returns ||
|---|---|
| `int` | the children count in the specified group <br /> |

### getCombinedChildId

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract 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 `https://developer.android.com/reference/android/widget/ExpandableListAdapter#hasStableIds()` is true, the returned ID must be stable as well.

<br />

| Parameters ||
|---|---|
| `groupId` | `long`: The ID of the group that contains this child. <br /> |
| `childId` | `long`: The ID of the child. <br /> |

| Returns ||
|---|---|
| `long` | The unique (and possibly stable) ID of the child across all groups and children in this list. <br /> |

### getCombinedGroupId

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract 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 `https://developer.android.com/reference/android/widget/ExpandableListAdapter#hasStableIds()` is true, the returned ID must be stable as well.

<br />

| Parameters ||
|---|---|
| `groupId` | `long`: The ID of the group <br /> |

| Returns ||
|---|---|
| `long` | The unique (and possibly stable) ID of the group across all groups and children in this list. <br /> |

### getGroup

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract Object getGroup (int groupPosition)
```

Gets the data associated with the given group.

<br />

| Parameters ||
|---|---|
| `groupPosition` | `int`: the position of the group <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/Object` | the data child for the specified group <br /> |

### getGroupCount

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract int getGroupCount ()
```

Gets the number of groups.

<br />

| Returns ||
|---|---|
| `int` | the number of groups <br /> |

### getGroupId

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract 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 `https://developer.android.com/reference/android/widget/ExpandableListAdapter#getCombinedGroupId(long)`) must be unique across ALL items (groups and all children).

<br />

| Parameters ||
|---|---|
| `groupPosition` | `int`: the position of the group for which the ID is wanted <br /> |

| Returns ||
|---|---|
| `long` | the ID associated with the group <br /> |

### getGroupView

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract 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 `https://developer.android.com/reference/android/widget/ExpandableListAdapter#getChildView(int,%20int,%20boolean,%20android.view.View,%20android.view.ViewGroup)`.

<br />

| Parameters ||
|---|---|
| `groupPosition` | `int`: the position of the group for which the View is returned <br /> |
| `isExpanded` | `boolean`: whether the group is expanded or collapsed <br /> |
| `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 `https://developer.android.com/reference/android/widget/ExpandableListAdapter#getGroupView(int,%20boolean,%20android.view.View,%20android.view.ViewGroup)`. <br /> |
| `parent` | `ViewGroup`: the parent that this view will eventually be attached to <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/View` | the View corresponding to the group at the specified position <br /> |

### hasStableIds

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract boolean hasStableIds ()
```

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

<br />

| Returns ||
|---|---|
| `boolean` | whether or not the same ID always refers to the same object <br /> |

**See also:**

- `https://developer.android.com/reference/android/widget/Adapter#hasStableIds()`

### isChildSelectable

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract boolean isChildSelectable (int groupPosition, 
                int childPosition)
```

Whether the child at the specified position is selectable.

<br />

| Parameters ||
|---|---|
| `groupPosition` | `int`: the position of the group that contains the child <br /> |
| `childPosition` | `int`: the position of the child within the group <br /> |

| Returns ||
|---|---|
| `boolean` | whether the child is selectable. <br /> |

### isEmpty

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract boolean isEmpty ()
```

<br />

<br />

| Returns ||
|---|---|
| `boolean` | <br /> |

**See also:**

- `https://developer.android.com/reference/android/widget/Adapter#isEmpty()`

### onGroupCollapsed

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract void onGroupCollapsed (int groupPosition)
```

Called when a group is collapsed.

<br />

| Parameters ||
|---|---|
| `groupPosition` | `int`: The group being collapsed. <br /> |

### onGroupExpanded

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract void onGroupExpanded (int groupPosition)
```

Called when a group is expanded.

<br />

| Parameters ||
|---|---|
| `groupPosition` | `int`: The group being expanded. <br /> |

### registerDataSetObserver

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract void registerDataSetObserver (DataSetObserver observer)
```

<br />

<br />

| Parameters ||
|---|---|
| `observer` | `DataSetObserver` <br /> |

**See also:**

- `https://developer.android.com/reference/android/widget/Adapter#registerDataSetObserver(android.database.DataSetObserver)`

### unregisterDataSetObserver

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract void unregisterDataSetObserver (DataSetObserver observer)
```

<br />

<br />

| Parameters ||
|---|---|
| `observer` | `DataSetObserver` <br /> |

**See also:**

- `https://developer.android.com/reference/android/widget/Adapter#unregisterDataSetObserver(android.database.DataSetObserver)`