Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Ctors](https://developer.android.com/reference/android/widget/BaseExpandableListAdapter#pubctors) \| [Methods](https://developer.android.com/reference/android/widget/BaseExpandableListAdapter#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/widget/BaseExpandableListAdapter#inhmethods)

# BaseExpandableListAdapter

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/widget/BaseExpandableListAdapter "View this page in Kotlin") \|Java


`
public


abstract
class
BaseExpandableListAdapter
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


implements

https://developer.android.com/reference/android/widget/ExpandableListAdapter,

https://developer.android.com/reference/android/widget/HeterogeneousExpandableList


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.widget.BaseExpandableListAdapter |

|---|
| Known direct subclasses [CursorTreeAdapter](https://developer.android.com/reference/android/widget/CursorTreeAdapter), [SimpleExpandableListAdapter](https://developer.android.com/reference/android/widget/SimpleExpandableListAdapter) |---|---| | [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. | | [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. | |

|---|
| Known indirect subclasses [ResourceCursorTreeAdapter](https://developer.android.com/reference/android/widget/ResourceCursorTreeAdapter), [SimpleCursorTreeAdapter](https://developer.android.com/reference/android/widget/SimpleCursorTreeAdapter) |---|---| | [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. | |

<br />

*** ** * ** ***

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.


Adapters inheriting this class should verify that the base implementations of
`https://developer.android.com/reference/android/widget/BaseExpandableListAdapter#getCombinedChildId(long,%20long)` and `https://developer.android.com/reference/android/widget/BaseExpandableListAdapter#getCombinedGroupId(long)`
are correct in generating unique IDs from the group/children IDs.

<br />

**See also:**

- `https://developer.android.com/reference/android/widget/SimpleExpandableListAdapter`
- `https://developer.android.com/reference/android/widget/SimpleCursorTreeAdapter`

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/widget/BaseExpandableListAdapter#BaseExpandableListAdapter()() ` |

| ### Public methods ||
|---|---|
| ` boolean` | ` https://developer.android.com/reference/android/widget/BaseExpandableListAdapter#areAllItemsEnabled()() ` |
| ` int` | ` https://developer.android.com/reference/android/widget/BaseExpandableListAdapter#getChildType(int,%20int)(int groupPosition, int childPosition) ` Get the type of child View that will be created by `https://developer.android.com/reference/android/widget/ExpandableListAdapter#getChildView(int,%20int,%20boolean,%20android.view.View,%20android.view.ViewGroup)` for the specified child item. |
| ` int` | ` https://developer.android.com/reference/android/widget/BaseExpandableListAdapter#getChildTypeCount()() ` <br /> Returns the number of types of child Views that will be created by `https://developer.android.com/reference/android/widget/ExpandableListAdapter#getChildView(int,%20int,%20boolean,%20android.view.View,%20android.view.ViewGroup)` . |
| ` long` | ` https://developer.android.com/reference/android/widget/BaseExpandableListAdapter#getCombinedChildId(long,%20long)(long groupId, long childId) ` Override this method if you foresee a clash in IDs based on this scheme: Base implementation returns a long: - bit 0: Whether this ID points to a child (unset) or group (set), so for this method this bit will be 1. <br /> |
| ` long` | ` https://developer.android.com/reference/android/widget/BaseExpandableListAdapter#getCombinedGroupId(long)(long groupId) ` Override this method if you foresee a clash in IDs based on this scheme: Base implementation returns a long: - bit 0: Whether this ID points to a child (unset) or group (set), so for this method this bit will be 0. <br /> |
| ` int` | ` https://developer.android.com/reference/android/widget/BaseExpandableListAdapter#getGroupType(int)(int groupPosition) ` Get the type of group View that will be created by `https://developer.android.com/reference/android/widget/ExpandableListAdapter#getGroupView(int,%20boolean,%20android.view.View,%20android.view.ViewGroup)` . |
| ` int` | ` https://developer.android.com/reference/android/widget/BaseExpandableListAdapter#getGroupTypeCount()() ` <br /> Returns the number of types of group Views that will be created by `https://developer.android.com/reference/android/widget/ExpandableListAdapter#getGroupView(int,%20boolean,%20android.view.View,%20android.view.ViewGroup)` . |
| ` boolean` | ` https://developer.android.com/reference/android/widget/BaseExpandableListAdapter#isEmpty()() ` |
| ` void` | ` https://developer.android.com/reference/android/widget/BaseExpandableListAdapter#notifyDataSetChanged()() ` |
| ` void` | ` https://developer.android.com/reference/android/widget/BaseExpandableListAdapter#notifyDataSetInvalidated()() ` |
| ` void` | ` https://developer.android.com/reference/android/widget/BaseExpandableListAdapter#onGroupCollapsed(int)(int groupPosition) ` Called when a group is collapsed. |
| ` void` | ` https://developer.android.com/reference/android/widget/BaseExpandableListAdapter#onGroupExpanded(int)(int groupPosition) ` Called when a group is expanded. |
| ` void` | ` https://developer.android.com/reference/android/widget/BaseExpandableListAdapter#registerDataSetObserver(android.database.DataSetObserver)(https://developer.android.com/reference/android/database/DataSetObserver observer) ` |
| ` void` | ` https://developer.android.com/reference/android/widget/BaseExpandableListAdapter#unregisterDataSetObserver(android.database.DataSetObserver)(https://developer.android.com/reference/android/database/DataSetObserver observer) ` |

| ### Inherited methods |
|---|---|
| From class ` https://developer.android.com/reference/java/lang/Object ` |---|---| | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/lang/Object#clone()() ` Creates and returns a copy of this object. | | ` boolean` | ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Indicates whether some other object is "equal to" this one. | | ` void` | ` https://developer.android.com/reference/java/lang/Object#finalize()() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. | | ` final https://developer.android.com/reference/java/lang/Class<?>` | ` https://developer.android.com/reference/java/lang/Object#getClass()() ` Returns the runtime class of this `Object`. | | ` int` | ` https://developer.android.com/reference/java/lang/Object#hashCode()() ` Returns a hash code value for the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notify()() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notifyAll()() ` Wakes up all threads that are waiting on this object's monitor. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/lang/Object#toString()() ` Returns a string representation of the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait()() ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*. | ||
| From interface ` https://developer.android.com/reference/android/widget/ExpandableListAdapter ` |---|---| | ` 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) ` | ||
| From interface ` https://developer.android.com/reference/android/widget/HeterogeneousExpandableList ` |---|---| | ` abstract int` | ` https://developer.android.com/reference/android/widget/HeterogeneousExpandableList#getChildType(int,%20int)(int groupPosition, int childPosition) ` Get the type of child View that will be created by `https://developer.android.com/reference/android/widget/ExpandableListAdapter#getChildView(int,%20int,%20boolean,%20android.view.View,%20android.view.ViewGroup)` for the specified child item. | | ` abstract int` | ` https://developer.android.com/reference/android/widget/HeterogeneousExpandableList#getChildTypeCount()() ` <br /> Returns the number of types of child Views that will be created by `https://developer.android.com/reference/android/widget/ExpandableListAdapter#getChildView(int,%20int,%20boolean,%20android.view.View,%20android.view.ViewGroup)` . | | ` abstract int` | ` https://developer.android.com/reference/android/widget/HeterogeneousExpandableList#getGroupType(int)(int groupPosition) ` Get the type of group View that will be created by `https://developer.android.com/reference/android/widget/ExpandableListAdapter#getGroupView(int,%20boolean,%20android.view.View,%20android.view.ViewGroup)` . | | ` abstract int` | ` https://developer.android.com/reference/android/widget/HeterogeneousExpandableList#getGroupTypeCount()() ` <br /> Returns the number of types of group Views that will be created by `https://developer.android.com/reference/android/widget/ExpandableListAdapter#getGroupView(int,%20boolean,%20android.view.View,%20android.view.ViewGroup)` . | ||

## Public constructors

### BaseExpandableListAdapter

```
public BaseExpandableListAdapter ()
```

<br />

<br />

## Public methods

### areAllItemsEnabled

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

```
public boolean areAllItemsEnabled ()
```

<br />

<br />

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

### getChildType

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

```
public int getChildType (int groupPosition, 
                int childPosition)
```

Get the type of child View that will be created by
`https://developer.android.com/reference/android/widget/ExpandableListAdapter#getChildView(int,%20int,%20boolean,%20android.view.View,%20android.view.ViewGroup)`
for the specified child item.

<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 ||
|---|---|
| `int` | 0 for any group or child position, since only one child type count is declared. <br /> |

### getChildTypeCount

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

```
public int getChildTypeCount ()
```

<br />


Returns the number of types of child Views that will be created by
`https://developer.android.com/reference/android/widget/ExpandableListAdapter#getChildView(int,%20int,%20boolean,%20android.view.View,%20android.view.ViewGroup)`
. Each type represents a set of views that can be converted in
`https://developer.android.com/reference/android/widget/ExpandableListAdapter#getChildView(int,%20int,%20boolean,%20android.view.View,%20android.view.ViewGroup)`
, for any group. If the adapter always returns the same type of View for
all child items, this method should return 1.
This method will only be called when the adapter is set on the `https://developer.android.com/reference/android/widget/AdapterView`.

<br />

<br />

| Returns ||
|---|---|
| `int` | 1 as a default value in BaseExpandableListAdapter. <br /> |

### getCombinedChildId

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

```
public long getCombinedChildId (long groupId, 
                long childId)
```

Override this method if you foresee a clash in IDs based on this scheme:


Base implementation returns a long:
- bit 0: Whether this ID points to a child (unset) or group (set), so for this method this bit will be 1.
- bit 1-31: Lower 31 bits of the groupId
- bit 32-63: Lower 32 bits of the 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 long getCombinedGroupId (long groupId)
```

Override this method if you foresee a clash in IDs based on this scheme:


Base implementation returns a long:
- bit 0: Whether this ID points to a child (unset) or group (set), so for this method this bit will be 0.
- bit 1-31: Lower 31 bits of the groupId
- bit 32-63: Lower 32 bits of the childId.
  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 /> |

### getGroupType

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

```
public int getGroupType (int groupPosition)
```

Get the type of group View that will be created by
`https://developer.android.com/reference/android/widget/ExpandableListAdapter#getGroupView(int,%20boolean,%20android.view.View,%20android.view.ViewGroup)`
. for the specified group item.

<br />

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

| Returns ||
|---|---|
| `int` | 0 for any groupPosition, since only one group type count is declared. <br /> |

### getGroupTypeCount

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

```
public int getGroupTypeCount ()
```

<br />


Returns the number of types of group Views that will be created by
`https://developer.android.com/reference/android/widget/ExpandableListAdapter#getGroupView(int,%20boolean,%20android.view.View,%20android.view.ViewGroup)`
. Each type represents a set of views that can be converted in
`https://developer.android.com/reference/android/widget/ExpandableListAdapter#getGroupView(int,%20boolean,%20android.view.View,%20android.view.ViewGroup)`
. If the adapter always returns the same type of View for all group items, this method should
return 1.
This method will only be called when the adapter is set on the `https://developer.android.com/reference/android/widget/AdapterView`.

<br />

<br />

| Returns ||
|---|---|
| `int` | 1 as a default value in BaseExpandableListAdapter. <br /> |

### isEmpty

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

```
public boolean isEmpty ()
```

<br />

<br />

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

### notifyDataSetChanged

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

```
public void notifyDataSetChanged ()
```

<br />

<br />

**See also:**

- `https://developer.android.com/reference/android/database/DataSetObservable#notifyChanged()`

### notifyDataSetInvalidated

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

```
public void notifyDataSetInvalidated ()
```

<br />

<br />

**See also:**

- `https://developer.android.com/reference/android/database/DataSetObservable#notifyInvalidated()`

### onGroupCollapsed

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

```
public 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 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 void registerDataSetObserver (DataSetObserver observer)
```

<br />

<br />

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

### unregisterDataSetObserver

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

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

<br />

<br />

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