Android APIs
Added in API level 8
public interface

HeterogeneousExpandableList

android.widget.HeterogeneousExpandableList
Known Indirect Subclasses

Class Overview

Additional methods that when implemented make an ExpandableListAdapter take advantage of the Adapter view type mechanism.

An ExpandableListAdapter declares it has one view type for its group items and one view type for its child items. Although adapted for most ExpandableListViews, these values should be tuned for heterogeneous ExpandableListViews.

Lists that contain different types of group and/or child item views, should use an adapter that implements this interface. This way, the recycled views that will be provided to getGroupView(int, boolean, View, ViewGroup) and getChildView(int, int, boolean, View, ViewGroup) will be of the appropriate group or child type, resulting in a more efficient reuse of the previously created views.

Summary

Public Methods
abstract int getChildType(int groupPosition, int childPosition)
Get the type of child View that will be created by 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 getChildView(int, int, boolean, View, ViewGroup) .

abstract int getGroupType(int groupPosition)
Get the type of group View that will be created by getGroupView(int, boolean, View, ViewGroup) .
abstract int getGroupTypeCount()

Returns the number of types of group Views that will be created by getGroupView(int, boolean, View, ViewGroup) .

Public Methods

public abstract int getChildType (int groupPosition, int childPosition)

Added in API level 8

Get the type of child View that will be created by getChildView(int, int, boolean, View, ViewGroup) for the specified child item.

Parameters
groupPosition the position of the group that the child resides in
childPosition the position of the child with respect to other children in the group
Returns

public abstract int getChildTypeCount ()

Added in API level 8

Returns the number of types of child Views that will be created by getChildView(int, int, boolean, View, ViewGroup) . Each type represents a set of views that can be converted in getChildView(int, int, boolean, 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 AdapterView.

Returns
  • The total number of types of child Views that will be created by this adapter.

public abstract int getGroupType (int groupPosition)

Added in API level 8

Get the type of group View that will be created by getGroupView(int, boolean, View, ViewGroup) . for the specified group item.

Parameters
groupPosition the position of the group for which the type should be returned.
Returns

public abstract int getGroupTypeCount ()

Added in API level 8

Returns the number of types of group Views that will be created by getGroupView(int, boolean, View, ViewGroup) . Each type represents a set of views that can be converted in getGroupView(int, boolean, 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 AdapterView.

Returns
  • The number of types of group Views that will be created by this adapter.