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/CursorTreeAdapter#pubctors) \| [Methods](https://developer.android.com/reference/android/widget/CursorTreeAdapter#pubmethods) \| [Protected Methods](https://developer.android.com/reference/android/widget/CursorTreeAdapter#promethods) \| [Inherited Methods](https://developer.android.com/reference/android/widget/CursorTreeAdapter#inhmethods)

# CursorTreeAdapter

*** ** * ** ***

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


`
public


abstract
class
CursorTreeAdapter
`


`


`

`

extends https://developer.android.com/reference/android/widget/BaseExpandableListAdapter


`

`


implements

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


`

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

|---|
| Known direct subclasses [ResourceCursorTreeAdapter](https://developer.android.com/reference/android/widget/ResourceCursorTreeAdapter) |---|---| | [ResourceCursorTreeAdapter](https://developer.android.com/reference/android/widget/ResourceCursorTreeAdapter) | A fairly simple ExpandableListAdapter that creates views defined in an XML file. | |

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

*** ** * ** ***

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. The top-level `https://developer.android.com/reference/android/database/Cursor` (that is
given in the constructor) exposes the groups, while subsequent `https://developer.android.com/reference/android/database/Cursor`s
returned from `https://developer.android.com/reference/android/widget/CursorTreeAdapter#getChildrenCursor(android.database.Cursor)` expose children within a
particular group. The Cursors must include a column named "_id" or this class
will not work.

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/widget/CursorTreeAdapter#CursorTreeAdapter(android.database.Cursor,%20android.content.Context)(https://developer.android.com/reference/android/database/Cursor cursor, https://developer.android.com/reference/android/content/Context context) ` Constructor. |
| ` https://developer.android.com/reference/android/widget/CursorTreeAdapter#CursorTreeAdapter(android.database.Cursor,%20android.content.Context,%20boolean)(https://developer.android.com/reference/android/database/Cursor cursor, https://developer.android.com/reference/android/content/Context context, boolean autoRequery) ` Constructor. |

| ### Public methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/android/widget/CursorTreeAdapter#changeCursor(android.database.Cursor)(https://developer.android.com/reference/android/database/Cursor cursor) ` |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/widget/CursorTreeAdapter#convertToString(android.database.Cursor)(https://developer.android.com/reference/android/database/Cursor cursor) ` |
| ` https://developer.android.com/reference/android/database/Cursor` | ` https://developer.android.com/reference/android/widget/CursorTreeAdapter#getChild(int,%20int)(int groupPosition, int childPosition) ` |
| ` long` | ` https://developer.android.com/reference/android/widget/CursorTreeAdapter#getChildId(int,%20int)(int groupPosition, int childPosition) ` |
| ` https://developer.android.com/reference/android/view/View` | ` https://developer.android.com/reference/android/widget/CursorTreeAdapter#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) ` |
| ` int` | ` https://developer.android.com/reference/android/widget/CursorTreeAdapter#getChildrenCount(int)(int groupPosition) ` |
| ` https://developer.android.com/reference/android/database/Cursor` | ` https://developer.android.com/reference/android/widget/CursorTreeAdapter#getCursor()() ` |
| ` https://developer.android.com/reference/android/widget/Filter` | ` https://developer.android.com/reference/android/widget/CursorTreeAdapter#getFilter()() ` <br /> Returns a filter that can be used to constrain data with a filtering pattern. |
| ` https://developer.android.com/reference/android/widget/FilterQueryProvider` | ` https://developer.android.com/reference/android/widget/CursorTreeAdapter#getFilterQueryProvider()() ` |
| ` https://developer.android.com/reference/android/database/Cursor` | ` https://developer.android.com/reference/android/widget/CursorTreeAdapter#getGroup(int)(int groupPosition) ` |
| ` int` | ` https://developer.android.com/reference/android/widget/CursorTreeAdapter#getGroupCount()() ` |
| ` long` | ` https://developer.android.com/reference/android/widget/CursorTreeAdapter#getGroupId(int)(int groupPosition) ` |
| ` https://developer.android.com/reference/android/view/View` | ` https://developer.android.com/reference/android/widget/CursorTreeAdapter#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) ` |
| ` boolean` | ` https://developer.android.com/reference/android/widget/CursorTreeAdapter#hasStableIds()() ` |
| ` boolean` | ` https://developer.android.com/reference/android/widget/CursorTreeAdapter#isChildSelectable(int,%20int)(int groupPosition, int childPosition) ` |
| ` void` | ` https://developer.android.com/reference/android/widget/CursorTreeAdapter#notifyDataSetChanged()() ` |
| ` void` | ` https://developer.android.com/reference/android/widget/CursorTreeAdapter#notifyDataSetChanged(boolean)(boolean releaseCursors) ` Notifies a data set change, but with the option of not releasing any cached cursors. |
| ` void` | ` https://developer.android.com/reference/android/widget/CursorTreeAdapter#notifyDataSetInvalidated()() ` |
| ` void` | ` https://developer.android.com/reference/android/widget/CursorTreeAdapter#onGroupCollapsed(int)(int groupPosition) ` Called when a group is collapsed. |
| ` https://developer.android.com/reference/android/database/Cursor` | ` https://developer.android.com/reference/android/widget/CursorTreeAdapter#runQueryOnBackgroundThread(java.lang.CharSequence)(https://developer.android.com/reference/java/lang/CharSequence constraint) ` |
| ` void` | ` https://developer.android.com/reference/android/widget/CursorTreeAdapter#setChildrenCursor(int,%20android.database.Cursor)(int groupPosition, https://developer.android.com/reference/android/database/Cursor childrenCursor) ` Sets the children Cursor for a particular group. |
| ` void` | ` https://developer.android.com/reference/android/widget/CursorTreeAdapter#setFilterQueryProvider(android.widget.FilterQueryProvider)(https://developer.android.com/reference/android/widget/FilterQueryProvider filterQueryProvider) ` |
| ` void` | ` https://developer.android.com/reference/android/widget/CursorTreeAdapter#setGroupCursor(android.database.Cursor)(https://developer.android.com/reference/android/database/Cursor cursor) ` Sets the group Cursor. |

| ### Protected methods ||
|---|---|
| ` abstract void` | ` https://developer.android.com/reference/android/widget/CursorTreeAdapter#bindChildView(android.view.View,%20android.content.Context,%20android.database.Cursor,%20boolean)(https://developer.android.com/reference/android/view/View view, https://developer.android.com/reference/android/content/Context context, https://developer.android.com/reference/android/database/Cursor cursor, boolean isLastChild) ` Bind an existing view to the child data pointed to by cursor |
| ` abstract void` | ` https://developer.android.com/reference/android/widget/CursorTreeAdapter#bindGroupView(android.view.View,%20android.content.Context,%20android.database.Cursor,%20boolean)(https://developer.android.com/reference/android/view/View view, https://developer.android.com/reference/android/content/Context context, https://developer.android.com/reference/android/database/Cursor cursor, boolean isExpanded) ` Bind an existing view to the group data pointed to by cursor. |
| ` abstract https://developer.android.com/reference/android/database/Cursor` | ` https://developer.android.com/reference/android/widget/CursorTreeAdapter#getChildrenCursor(android.database.Cursor)(https://developer.android.com/reference/android/database/Cursor groupCursor) ` Gets the Cursor for the children at the given group. |
| ` abstract https://developer.android.com/reference/android/view/View` | ` https://developer.android.com/reference/android/widget/CursorTreeAdapter#newChildView(android.content.Context,%20android.database.Cursor,%20boolean,%20android.view.ViewGroup)(https://developer.android.com/reference/android/content/Context context, https://developer.android.com/reference/android/database/Cursor cursor, boolean isLastChild, https://developer.android.com/reference/android/view/ViewGroup parent) ` Makes a new child view to hold the data pointed to by cursor. |
| ` abstract https://developer.android.com/reference/android/view/View` | ` https://developer.android.com/reference/android/widget/CursorTreeAdapter#newGroupView(android.content.Context,%20android.database.Cursor,%20boolean,%20android.view.ViewGroup)(https://developer.android.com/reference/android/content/Context context, https://developer.android.com/reference/android/database/Cursor cursor, boolean isExpanded, https://developer.android.com/reference/android/view/ViewGroup parent) ` Makes a new group view to hold the group data pointed to by cursor. |

| ### Inherited methods |
|---|---|
| From class ` https://developer.android.com/reference/android/widget/BaseExpandableListAdapter ` |---|---| | ` 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) ` | ||
| 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)` . | ||
| From interface ` https://developer.android.com/reference/android/widget/Filterable ` |---|---| | ` abstract https://developer.android.com/reference/android/widget/Filter` | ` https://developer.android.com/reference/android/widget/Filterable#getFilter()() ` <br /> Returns a filter that can be used to constrain data with a filtering pattern. | ||

## Public constructors

### CursorTreeAdapter

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

```
public CursorTreeAdapter (Cursor cursor, 
                Context context)
```

Constructor. The adapter will call `https://developer.android.com/reference/android/database/Cursor#requery()` on the cursor whenever
it changes so that the most recent data is always displayed.

<br />

| Parameters ||
|---|---|
| `cursor` | `Cursor`: The cursor from which to get the data for the groups. <br /> |
| `context` | `Context` <br /> |

### CursorTreeAdapter

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

```
public CursorTreeAdapter (Cursor cursor, 
                Context context, 
                boolean autoRequery)
```

Constructor.

<br />

| Parameters ||
|---|---|
| `cursor` | `Cursor`: The cursor from which to get the data for the groups. <br /> |
| `context` | `Context`: The context <br /> |
| `autoRequery` | `boolean`: If true the adapter will call `https://developer.android.com/reference/android/database/Cursor#requery()` on the cursor whenever it changes so the most recent data is always displayed. <br /> |

## Public methods

### changeCursor

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

```
public void changeCursor (Cursor cursor)
```

<br />

<br />

| Parameters ||
|---|---|
| `cursor` | `Cursor` <br /> |

**See also:**

- `https://developer.android.com/reference/android/widget/CursorAdapter#changeCursor(android.database.Cursor)`

### convertToString

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

```
public String convertToString (Cursor cursor)
```

<br />

<br />

| Parameters ||
|---|---|
| `cursor` | `Cursor` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | <br /> |

**See also:**

- `https://developer.android.com/reference/android/widget/CursorAdapter#convertToString(android.database.Cursor)`

### getChild

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

```
public Cursor getChild (int groupPosition, 
                int childPosition)
```

<br />

<br />

| Parameters ||
|---|---|
| `groupPosition` | `int` <br /> |
| `childPosition` | `int` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/database/Cursor` | <br /> |

### getChildId

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

```
public long getChildId (int groupPosition, 
                int childPosition)
```

<br />

<br />

| Parameters ||
|---|---|
| `groupPosition` | `int` <br /> |
| `childPosition` | `int` <br /> |

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

### getChildView

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

```
public View getChildView (int groupPosition, 
                int childPosition, 
                boolean isLastChild, 
                View convertView, 
                ViewGroup parent)
```

<br />

<br />

| Parameters ||
|---|---|
| `groupPosition` | `int` <br /> |
| `childPosition` | `int` <br /> |
| `isLastChild` | `boolean` <br /> |
| `convertView` | `View` <br /> |
| `parent` | `ViewGroup` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/View` | <br /> |

### getChildrenCount

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

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

<br />

<br />

| Parameters ||
|---|---|
| `groupPosition` | `int` <br /> |

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

### getCursor

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

```
public Cursor getCursor ()
```

<br />

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/database/Cursor` | <br /> |

**See also:**

- `https://developer.android.com/reference/android/widget/CursorAdapter#getCursor()`

### getFilter

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

```
public Filter getFilter ()
```

<br />

Returns a filter that can be used to constrain data with a filtering
pattern.

This method is usually implemented by `https://developer.android.com/reference/android/widget/Adapter`
classes.

<br />

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/widget/Filter` | a filter used to constrain data <br /> |

### getFilterQueryProvider

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

```
public FilterQueryProvider getFilterQueryProvider ()
```

<br />

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/widget/FilterQueryProvider` | <br /> |

**See also:**

- `https://developer.android.com/reference/android/widget/CursorAdapter#getFilterQueryProvider()`

### getGroup

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

```
public Cursor getGroup (int groupPosition)
```

<br />

<br />

| Parameters ||
|---|---|
| `groupPosition` | `int` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/database/Cursor` | <br /> |

### getGroupCount

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

```
public int getGroupCount ()
```

<br />

<br />

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

### getGroupId

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

```
public long getGroupId (int groupPosition)
```

<br />

<br />

| Parameters ||
|---|---|
| `groupPosition` | `int` <br /> |

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

### getGroupView

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

```
public View getGroupView (int groupPosition, 
                boolean isExpanded, 
                View convertView, 
                ViewGroup parent)
```

<br />

<br />

| Parameters ||
|---|---|
| `groupPosition` | `int` <br /> |
| `isExpanded` | `boolean` <br /> |
| `convertView` | `View` <br /> |
| `parent` | `ViewGroup` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/View` | <br /> |

### hasStableIds

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

```
public boolean hasStableIds ()
```

<br />

<br />

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

### isChildSelectable

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

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

<br />

<br />

| Parameters ||
|---|---|
| `groupPosition` | `int` <br /> |
| `childPosition` | `int` <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 />

### notifyDataSetChanged

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

```
public void notifyDataSetChanged (boolean releaseCursors)
```

Notifies a data set change, but with the option of not releasing any
cached cursors.

<br />

| Parameters ||
|---|---|
| `releaseCursors` | `boolean`: Whether to release and deactivate any cached cursors. <br /> |

### notifyDataSetInvalidated

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

```
public void notifyDataSetInvalidated ()
```

<br />

<br />

### 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 /> |

### runQueryOnBackgroundThread

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

```
public Cursor runQueryOnBackgroundThread (CharSequence constraint)
```

<br />

<br />

| Parameters ||
|---|---|
| `constraint` | `CharSequence` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/database/Cursor` | <br /> |

**See also:**

- `https://developer.android.com/reference/android/widget/CursorAdapter#runQueryOnBackgroundThread(java.lang.CharSequence)`

### setChildrenCursor

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

```
public void setChildrenCursor (int groupPosition, 
                Cursor childrenCursor)
```

Sets the children Cursor for a particular group. If there is an existing cursor
it will be closed.


This is useful when asynchronously querying to prevent blocking the UI.

<br />

| Parameters ||
|---|---|
| `groupPosition` | `int`: The group whose children are being set via this Cursor. <br /> |
| `childrenCursor` | `Cursor`: The Cursor that contains the children of the group. <br /> |

### setFilterQueryProvider

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

```
public void setFilterQueryProvider (FilterQueryProvider filterQueryProvider)
```

<br />

<br />

| Parameters ||
|---|---|
| `filterQueryProvider` | `FilterQueryProvider` <br /> |

**See also:**

- `https://developer.android.com/reference/android/widget/CursorAdapter#setFilterQueryProvider(android.widget.FilterQueryProvider)`

### setGroupCursor

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

```
public void setGroupCursor (Cursor cursor)
```

Sets the group Cursor.

<br />

| Parameters ||
|---|---|
| `cursor` | `Cursor`: The Cursor to set for the group. If there is an existing cursor it will be closed. <br /> |

## Protected methods

### bindChildView

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

```
protected abstract void bindChildView (View view, 
                Context context, 
                Cursor cursor, 
                boolean isLastChild)
```

Bind an existing view to the child data pointed to by cursor

<br />

| Parameters ||
|---|---|
| `view` | `View`: Existing view, returned earlier by newChildView <br /> |
| `context` | `Context`: Interface to application's global information <br /> |
| `cursor` | `Cursor`: The cursor from which to get the data. The cursor is already moved to the correct position. <br /> |
| `isLastChild` | `boolean`: Whether the child is the last child within its group. <br /> |

### bindGroupView

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

```
protected abstract void bindGroupView (View view, 
                Context context, 
                Cursor cursor, 
                boolean isExpanded)
```

Bind an existing view to the group data pointed to by cursor.

<br />

| Parameters ||
|---|---|
| `view` | `View`: Existing view, returned earlier by newGroupView. <br /> |
| `context` | `Context`: Interface to application's global information <br /> |
| `cursor` | `Cursor`: The cursor from which to get the data. The cursor is already moved to the correct position. <br /> |
| `isExpanded` | `boolean`: Whether the group is expanded. <br /> |

### getChildrenCursor

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

```
protected abstract Cursor getChildrenCursor (Cursor groupCursor)
```

Gets the Cursor for the children at the given group. Subclasses must
implement this method to return the children data for a particular group.


If you want to asynchronously query a provider to prevent blocking the
UI, it is possible to return null and at a later time call
`https://developer.android.com/reference/android/widget/CursorTreeAdapter#setChildrenCursor(int,%20android.database.Cursor)`.


It is your responsibility to manage this Cursor through the Activity
lifecycle. It is a good idea to use `https://developer.android.com/reference/android/app/Activity#managedQuery(android.net.Uri,%20java.lang.String[],%20java.lang.String,%20java.lang.String[],%20java.lang.String)` which
will handle this for you. In some situations, the adapter will deactivate
the Cursor on its own, but this will not always be the case, so please
ensure the Cursor is properly managed.

<br />

| Parameters ||
|---|---|
| `groupCursor` | `Cursor`: The cursor pointing to the group whose children cursor should be returned <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/database/Cursor` | The cursor for the children of a particular group, or null. <br /> |

### newChildView

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

```
protected abstract View newChildView (Context context, 
                Cursor cursor, 
                boolean isLastChild, 
                ViewGroup parent)
```

Makes a new child view to hold the data pointed to by cursor.

<br />

| Parameters ||
|---|---|
| `context` | `Context`: Interface to application's global information <br /> |
| `cursor` | `Cursor`: The cursor from which to get the data. The cursor is already moved to the correct position. <br /> |
| `isLastChild` | `boolean`: Whether the child is the last child within its group. <br /> |
| `parent` | `ViewGroup`: The parent to which the new view is attached to <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/View` | the newly created view. <br /> |

### newGroupView

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

```
protected abstract View newGroupView (Context context, 
                Cursor cursor, 
                boolean isExpanded, 
                ViewGroup parent)
```

Makes a new group view to hold the group data pointed to by cursor.

<br />

| Parameters ||
|---|---|
| `context` | `Context`: Interface to application's global information <br /> |
| `cursor` | `Cursor`: The group cursor from which to get the data. The cursor is already moved to the correct position. <br /> |
| `isExpanded` | `boolean`: Whether the group is expanded. <br /> |
| `parent` | `ViewGroup`: The parent to which the new view is attached to <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/View` | The newly created view. <br /> |