Stay organized with collections
    
    
      
      Save and categorize content based on your preferences.
    
  
  
    
  
  
  
  
    
  
  
    
    
  
  
ResourceCursorTreeAdapter
  public
  
  
  abstract
  class
  ResourceCursorTreeAdapter
  
  
  
  
  
  
  
    extends CursorTreeAdapter
  
  
  
  
  
  
  
    
      | 
          Known direct subclasses
          
  
  
    
  
  
    
      
        | SimpleCursorTreeAdapter | An easy adapter to map columns from a cursor to TextViews or ImageViews
 defined in an XML file. |  | 
  
  
  
    
  A fairly simple ExpandableListAdapter that creates views defined in an XML
 file. You can specify the XML file that defines the appearance of the views.
Summary
| Public constructors | 
|---|
  
  
  
    | 
      ResourceCursorTreeAdapter(Context context, Cursor cursor, int groupLayout, int childLayout)
      Constructor.
        
    
 | 
  
  
  
  
    | 
      ResourceCursorTreeAdapter(Context context, Cursor cursor, int collapsedGroupLayout, int expandedGroupLayout, int childLayout)
      Constructor.
        
    
 | 
  
  
  
  
    | 
      ResourceCursorTreeAdapter(Context context, Cursor cursor, int collapsedGroupLayout, int expandedGroupLayout, int childLayout, int lastChildLayout)
      Constructor.
        
    
 | 
  
| Inherited methods | 
|---|
| 
    From class
      
        
          android.widget.CursorTreeAdapter
        
      
      
  
  
  
    | 
        abstract
        
        
        
        
        void | 
      bindChildView(View view, Context context, Cursor cursor, boolean isLastChild)
      Bind an existing view to the child data pointed to by cursor
        
    
 |  
  
  
    | 
        abstract
        
        
        
        
        void | 
      bindGroupView(View view, Context context, Cursor cursor, boolean isExpanded)
      Bind an existing view to the group data pointed to by cursor.
        
    
 |  
  
  
    | 
        
        
        
        
        
        void | 
      changeCursor(Cursor cursor)
       |  
  
  
    | 
        
        
        
        
        
        String | 
      convertToString(Cursor cursor)
       |  
  
  
    | 
        
        
        
        
        
        Cursor | 
      getChild(int groupPosition, int childPosition)
       |  
  
  
    | 
        
        
        
        
        
        long | 
      getChildId(int groupPosition, int childPosition)
       |  
  
  
    | 
        
        
        
        
        
        View | 
      getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent)
       |  
  
  
    | 
        
        
        
        
        
        int | 
      getChildrenCount(int groupPosition)
       |  
  
  
    | 
        abstract
        
        
        
        
        Cursor | 
      getChildrenCursor(Cursor groupCursor)
      Gets the Cursor for the children at the given group.
        
    
 |  
  
  
    | 
        
        
        
        
        
        Cursor | 
      getCursor()
       |  
  
  
    | 
        
        
        
        
        
        Filter | 
      getFilter()
      Returns a filter that can be used to constrain data with a filtering
 pattern.
        
    
 |  
  
  
    | 
        
        
        
        
        
        FilterQueryProvider | 
      getFilterQueryProvider()
       |  
  
  
    | 
        
        
        
        
        
        Cursor | 
      getGroup(int groupPosition)
       |  
  
  
    | 
        
        
        
        
        
        int | 
      getGroupCount()
       |  
  
  
    | 
        
        
        
        
        
        long | 
      getGroupId(int groupPosition)
       |  
  
  
    | 
        
        
        
        
        
        View | 
      getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent)
       |  
  
  
    | 
        
        
        
        
        
        boolean | 
      hasStableIds()
       |  
  
  
    | 
        
        
        
        
        
        boolean | 
      isChildSelectable(int groupPosition, int childPosition)
       |  
  
  
    | 
        abstract
        
        
        
        
        View | 
      newChildView(Context context, Cursor cursor, boolean isLastChild, ViewGroup parent)
      Makes a new child view to hold the data pointed to by cursor.
        
    
 |  
  
  
    | 
        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.
        
    
 |  
  
  
    | 
        
        
        
        
        
        void | 
      notifyDataSetChanged()
       |  
  
  
    | 
        
        
        
        
        
        void | 
      notifyDataSetChanged(boolean releaseCursors)
      Notifies a data set change, but with the option of not releasing any
 cached cursors.
        
    
 |  
  
  
    | 
        
        
        
        
        
        void | 
      notifyDataSetInvalidated()
       |  
  
  
    | 
        
        
        
        
        
        void | 
      onGroupCollapsed(int groupPosition)
      Called when a group is collapsed.
        
    
 |  
  
  
    | 
        
        
        
        
        
        Cursor | 
      runQueryOnBackgroundThread(CharSequence constraint)
       |  
  
  
    | 
        
        
        
        
        
        void | 
      setChildrenCursor(int groupPosition, Cursor childrenCursor)
      Sets the children Cursor for a particular group.
        
    
 |  
  
  
    | 
        
        
        
        
        
        void | 
      setFilterQueryProvider(FilterQueryProvider filterQueryProvider)
       |  
  
  
    | 
        
        
        
        
        
        void | 
      setGroupCursor(Cursor cursor)
      Sets the group Cursor.
        
    
 |  | 
| 
    From class
      
        
          android.widget.BaseExpandableListAdapter
        
      
      
  
  
  
    | 
        
        
        
        
        
        boolean | 
      areAllItemsEnabled()
       |  
  
  
    | 
        
        
        
        
        
        int | 
      getChildType(int groupPosition, int childPosition)
      Get the type of child View that will be created by
 ExpandableListAdapter.getChildView(int, int, boolean, View, ViewGroup)for the specified child item. |  
  
  
    | 
        
        
        
        
        
        int | 
      getChildTypeCount()
      
 Returns the number of types of child Views that will be created by
 ExpandableListAdapter.getChildView(int, int, boolean, View, ViewGroup). |  
  
  
    | 
        
        
        
        
        
        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. |  
  
  
    | 
        
        
        
        
        
        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. |  
  
  
    | 
        
        
        
        
        
        int | 
      getGroupType(int groupPosition)
      Get the type of group View that will be created by
 ExpandableListAdapter.getGroupView(int, boolean, View, ViewGroup). |  
  
  
    | 
        
        
        
        
        
        int | 
      getGroupTypeCount()
      
 Returns the number of types of group Views that will be created by
 ExpandableListAdapter.getGroupView(int, boolean, View, ViewGroup). |  
  
  
    | 
        
        
        
        
        
        boolean | 
      isEmpty()
      
        
    
 |  
  
  
    | 
        
        
        
        
        
        void | 
      notifyDataSetChanged()
       |  
  
  
    | 
        
        
        
        
        
        void | 
      notifyDataSetInvalidated()
       |  
  
  
    | 
        
        
        
        
        
        void | 
      onGroupCollapsed(int groupPosition)
      Called when a group is collapsed.
        
    
 |  
  
  
    | 
        
        
        
        
        
        void | 
      onGroupExpanded(int groupPosition)
      Called when a group is expanded.
        
    
 |  
  
  
    | 
        
        
        
        
        
        void | 
      registerDataSetObserver(DataSetObserver observer)
       |  
  
  
    | 
        
        
        
        
        
        void | 
      unregisterDataSetObserver(DataSetObserver observer)
       |  | 
| 
    From class
      
        
          java.lang.Object
        
      
      
  
  
  
    | 
        
        
        
        
        
        Object | 
      clone()
      Creates and returns a copy of this object.
        
    
 |  
  
  
    | 
        
        
        
        
        
        boolean | 
      equals(Object obj)
      Indicates whether some other object is "equal to" this one.
        
    
 |  
  
  
    | 
        
        
        
        
        
        void | 
      finalize()
      Called by the garbage collector on an object when garbage collection
 determines that there are no more references to the object.
        
    
 |  
  
  
    | 
        
        
        
        final
        
        Class<?> | 
      getClass()
      Returns the runtime class of this Object. |  
  
  
    | 
        
        
        
        
        
        int | 
      hashCode()
      Returns a hash code value for the object.
        
    
 |  
  
  
    | 
        
        
        
        final
        
        void | 
      notify()
      Wakes up a single thread that is waiting on this object's
 monitor.
        
    
 |  
  
  
    | 
        
        
        
        final
        
        void | 
      notifyAll()
      Wakes up all threads that are waiting on this object's monitor.
        
    
 |  
  
  
    | 
        
        
        
        
        
        String | 
      toString()
      Returns a string representation of the object.
        
    
 |  
  
  
    | 
        
        
        
        final
        
        void | 
      wait(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 | 
      wait(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 | 
      wait()
      Causes the current thread to wait until it is awakened, typically
 by being notified or interrupted.
        
    
 |  | 
|  | 
| 
    From interface
      
        
          android.widget.ExpandableListAdapter
        
      
      
  
  
  
    | 
        abstract
        
        
        
        
        boolean | 
      areAllItemsEnabled()
       |  
  
  
    | 
        abstract
        
        
        
        
        Object | 
      getChild(int groupPosition, int childPosition)
      Gets the data associated with the given child within the given group.
        
    
 |  
  
  
    | 
        abstract
        
        
        
        
        long | 
      getChildId(int groupPosition, int childPosition)
      Gets the ID for the given child within the given group.
        
    
 |  
  
  
    | 
        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.
        
    
 |  
  
  
    | 
        abstract
        
        
        
        
        int | 
      getChildrenCount(int groupPosition)
      Gets the number of children in a specified group.
        
    
 |  
  
  
    | 
        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.
        
    
 |  
  
  
    | 
        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.
        
    
 |  
  
  
    | 
        abstract
        
        
        
        
        Object | 
      getGroup(int groupPosition)
      Gets the data associated with the given group.
        
    
 |  
  
  
    | 
        abstract
        
        
        
        
        int | 
      getGroupCount()
      Gets the number of groups.
        
    
 |  
  
  
    | 
        abstract
        
        
        
        
        long | 
      getGroupId(int groupPosition)
      Gets the ID for the group at the given position.
        
    
 |  
  
  
    | 
        abstract
        
        
        
        
        View | 
      getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent)
      Gets a View that displays the given group.
        
    
 |  
  
  
    | 
        abstract
        
        
        
        
        boolean | 
      hasStableIds()
      Indicates whether the child and group IDs are stable across changes to the
 underlying data.
        
    
 |  
  
  
    | 
        abstract
        
        
        
        
        boolean | 
      isChildSelectable(int groupPosition, int childPosition)
      Whether the child at the specified position is selectable.
        
    
 |  
  
  
    | 
        abstract
        
        
        
        
        boolean | 
      isEmpty()
       |  
  
  
    | 
        abstract
        
        
        
        
        void | 
      onGroupCollapsed(int groupPosition)
      Called when a group is collapsed.
        
    
 |  
  
  
    | 
        abstract
        
        
        
        
        void | 
      onGroupExpanded(int groupPosition)
      Called when a group is expanded.
        
    
 |  
  
  
    | 
        abstract
        
        
        
        
        void | 
      registerDataSetObserver(DataSetObserver observer)
       |  
  
  
    | 
        abstract
        
        
        
        
        void | 
      unregisterDataSetObserver(DataSetObserver observer)
       |  | 
| 
    From interface
      
        
          android.widget.HeterogeneousExpandableList
        
      
      
  
  
  
    | 
        abstract
        
        
        
        
        int | 
      getChildType(int groupPosition, int childPosition)
      Get the type of child View that will be created by
 ExpandableListAdapter.getChildView(int, int, boolean, View, ViewGroup)for the specified child item. |  
  
  
    | 
        abstract
        
        
        
        
        int | 
      getChildTypeCount()
      
 Returns the number of types of child Views that will be created by
 ExpandableListAdapter.getChildView(int, int, boolean, View, ViewGroup). |  
  
  
    | 
        abstract
        
        
        
        
        int | 
      getGroupType(int groupPosition)
      Get the type of group View that will be created by
 ExpandableListAdapter.getGroupView(int, boolean, View, ViewGroup). |  
  
  
    | 
        abstract
        
        
        
        
        int | 
      getGroupTypeCount()
      
 Returns the number of types of group Views that will be created by
 ExpandableListAdapter.getGroupView(int, boolean, View, ViewGroup). |  | 
Public constructors
    ResourceCursorTreeAdapter
    
public ResourceCursorTreeAdapter (Context context, 
                Cursor cursor, 
                int groupLayout, 
                int childLayout)
    
    
    
  Constructor.
    
    | Parameters | 
|---|
      
        | context | Context: The context where the ListView associated with this
            SimpleListItemFactory is running | 
      
        | cursor | Cursor: The database cursor | 
      
        | groupLayout | int: resource identifier of a layout file that defines the
            views for all groups. | 
      
        | childLayout | int: resource identifier of a layout file that defines the
            views for all children. | 
    
 
    ResourceCursorTreeAdapter
    
public ResourceCursorTreeAdapter (Context context, 
                Cursor cursor, 
                int collapsedGroupLayout, 
                int expandedGroupLayout, 
                int childLayout)
    
    
    
  Constructor.
    
    | Parameters | 
|---|
      
        | context | Context: The context where the ListView associated with this
            SimpleListItemFactory is running | 
      
        | cursor | Cursor: The database cursor | 
      
        | collapsedGroupLayout | int: resource identifier of a layout file that
            defines the views for collapsed groups. | 
      
        | expandedGroupLayout | int: resource identifier of a layout file that
            defines the views for expanded groups. | 
      
        | childLayout | int: resource identifier of a layout file that defines the
            views for all children. | 
    
 
    ResourceCursorTreeAdapter
    
public ResourceCursorTreeAdapter (Context context, 
                Cursor cursor, 
                int collapsedGroupLayout, 
                int expandedGroupLayout, 
                int childLayout, 
                int lastChildLayout)
    
    
    
  Constructor.
    
    | Parameters | 
|---|
      
        | context | Context: The context where the ListView associated with this
            SimpleListItemFactory is running | 
      
        | cursor | Cursor: The database cursor | 
      
        | collapsedGroupLayout | int: resource identifier of a layout file that
            defines the views for collapsed groups. | 
      
        | expandedGroupLayout | int: resource identifier of a layout file that
            defines the views for expanded groups. | 
      
        | childLayout | int: resource identifier of a layout file that defines the
            views for all children but the last.. | 
      
        | lastChildLayout | int: resource identifier of a layout file that defines
            the views for the last child of a group. | 
    
 
Public methods
    newChildView
    
public View newChildView (Context context, 
                Cursor cursor, 
                boolean isLastChild, 
                ViewGroup parent)
    
    
    
  Makes a new child view to hold the data pointed to by cursor.
    
    | Parameters | 
|---|
      
        | context | Context: Interface to application's global information | 
      
        | cursor | Cursor: The cursor from which to get the data. The cursor is
            already moved to the correct position. | 
      
        | isLastChild | boolean: Whether the child is the last child within its group. | 
      
        | parent | ViewGroup: The parent to which the new view is attached to | 
    
    
      | Returns | 
|---|
      
        | View | the newly created view. | 
    
 
    newGroupView
    
public View newGroupView (Context context, 
                Cursor cursor, 
                boolean isExpanded, 
                ViewGroup parent)
    
    
    
  Makes a new group view to hold the group data pointed to by cursor.
    
    | Parameters | 
|---|
      
        | context | Context: Interface to application's global information | 
      
        | cursor | Cursor: The group cursor from which to get the data. The cursor is
            already moved to the correct position. | 
      
        | isExpanded | boolean: Whether the group is expanded. | 
      
        | parent | ViewGroup: The parent to which the new view is attached to | 
    
    
      | Returns | 
|---|
      
        | View | The newly created view. | 
    
 
 
 
  
  
    
  
 
  
    
    
      
       
    
    
  
  
  Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
  Last updated 2025-02-10 UTC.
  
  
  
    
      [null,null,["Last updated 2025-02-10 UTC."],[],[]]