English | Site Directory

Android - An Open Handset Alliance Project

android.widget
public abstract class

android.widget.BaseExpandableListAdapter

java.lang.Object
android.widget.BaseExpandableListAdapter ExpandableListAdapter

Base class for a 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 getCombinedChildId(long, long) and getCombinedGroupId(long) are correct in generating unique IDs from the group/children IDs.

Known Direct Subclasses
Known Indirect Subclasses

Summary

Fields

protected    final  DataSetObservable  mDataSetObservable   

Public Constructors

          BaseExpandableListAdapter()

Public Methods

        boolean  areAllItemsSelectable()
Are all items in this ExpandableListAdapter selectable?
        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 0.
  •         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 1.
  •         long  getNewSelectionForKey(long packedPosition, int keyCode, KeyEvent event)
    Given a keyboard key, let the adapter suggest the group/child to be made the new selected child.
            void  notifyDataSetChanged()
            void  notifyDataSetInvalidated()
            void  onGroupCollapsed(int groupPosition)
    Called when a group is being collapsed.
            void  onGroupExpanded(int groupPosition)
    Called when a group is being expanded.
            void  registerDataSetObserver(DataSetObserver observer)
    Register an observer that is called when changes happen to the data used by this adapter.
            void  unregisterDataSetObserver(DataSetObserver observer)
    Unregister an observer that has previously been registered with this adapter via registerDataSetObserver(DataSetObserver).
    Methods inherited from class java.lang.Object
    Methods inherited from interface android.widget.ExpandableListAdapter

    Details

    Fields

    protected final DataSetObservable mDataSetObservable

    Public Constructors

    public BaseExpandableListAdapter()

    Public Methods

    public boolean areAllItemsSelectable()

    Are all items in this ExpandableListAdapter selectable?

    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 0.
  • 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 stableIds() is true, the returned ID must be stable as well.

  • 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 1.
  • 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 stableIds() is true, the returned ID must be stable as well.

  • public long getNewSelectionForKey(long packedPosition, int keyCode, KeyEvent event)

    Given a keyboard key, let the adapter suggest the group/child to be made the new selected child. Return PACKED_POSITION_VALUE_NULL to indicate no appropriate key (for example, the user pressed the back button, or a subclass does not support this feature) or for no preference.

    public void notifyDataSetChanged()

    See Also

    public void notifyDataSetInvalidated()

    public void onGroupCollapsed(int groupPosition)

    Called when a group is being collapsed.

    public void onGroupExpanded(int groupPosition)

    Called when a group is being expanded.

    public void registerDataSetObserver(DataSetObserver observer)

    Register an observer that is called when changes happen to the data used by this adapter.

    public void unregisterDataSetObserver(DataSetObserver observer)

    Unregister an observer that has previously been registered with this adapter via registerDataSetObserver(DataSetObserver).
    Build m5-rc15i - 10 Jun 2008 13:54