FileDocCategorySizeDatePackage
BaseExpandableListAdapter.javaAPI DocAndroid 5.1 API4148Thu Mar 12 22:22:10 GMT 2015android.widget

BaseExpandableListAdapter

public abstract class BaseExpandableListAdapter extends Object implements HeterogeneousExpandableList, ExpandableListAdapter
Base class for a {@link 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 {@link #getCombinedChildId(long, long)} and {@link #getCombinedGroupId(long)} are correct in generating unique IDs from the group/children IDs.

see
SimpleExpandableListAdapter
see
SimpleCursorTreeAdapter

Fields Summary
private final android.database.DataSetObservable
mDataSetObservable
Constructors Summary
Methods Summary
public booleanareAllItemsEnabled()

        return true;
    
public intgetChildType(int groupPosition, int childPosition)
{@inheritDoc}

return
0 for any group or child position, since only one child type count is declared.

        return 0;
    
public intgetChildTypeCount()
{@inheritDoc}

return
1 as a default value in BaseExpandableListAdapter.

        return 1;
    
public longgetCombinedChildId(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.

    {@inheritDoc}

            return 0x8000000000000000L | ((groupId & 0x7FFFFFFF) << 32) | (childId & 0xFFFFFFFF);
        
  • public longgetCombinedGroupId(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.

    {@inheritDoc}

            return (groupId & 0x7FFFFFFF) << 32;
        
  • public intgetGroupType(int groupPosition)
    {@inheritDoc}

    return
    0 for any groupPosition, since only one group type count is declared.

            return 0;
        
    public intgetGroupTypeCount()
    {@inheritDoc}

    return
    1 as a default value in BaseExpandableListAdapter.

            return 1;
        
    public booleanisEmpty()
    {@inheritDoc}

            return getGroupCount() == 0;
        
    public voidnotifyDataSetChanged()

    see
    DataSetObservable#notifyChanged()

            mDataSetObservable.notifyChanged();
        
    public voidnotifyDataSetInvalidated()

    see
    DataSetObservable#notifyInvalidated()

            mDataSetObservable.notifyInvalidated();
        
    public voidonGroupCollapsed(int groupPosition)

        
    public voidonGroupExpanded(int groupPosition)

        
    public voidregisterDataSetObserver(android.database.DataSetObserver observer)

        
            
            mDataSetObservable.registerObserver(observer);
        
    public voidunregisterDataSetObserver(android.database.DataSetObserver observer)

            mDataSetObservable.unregisterObserver(observer);