English | Site Directory

Android - An Open Handset Alliance Project

android.widget
public abstract class

android.widget.AdapterView

java.lang.Object
android.view.View Drawable.Callback KeyEvent.Callback
android.view.ViewGroup ViewManager ViewParent
android.widget.AdapterView

An AdapterView is a view whose children are determined by an Adapter.

See ListView, GridView, Spinner and Gallery for commonly used subclasses of AdapterView.

Also see ViewGroup.LayoutParams for layout attributes.

Nested Classes
AdapterView.ContextMenuInfo Extra menu information provided to the onPopulateContextMenu(ContextMenu, View, Object) callback when a context menu is brought up for this AdapterView. 
AdapterView.MyDataSetObserver  
AdapterView.OnItemClickListener Interface definition for a callback to be invoked when an item in this AdapterView has been clicked. 
AdapterView.OnItemLongClickListener Interface definition for a callback to be invoked when an item in this view has been clicked and held. 
AdapterView.OnItemSelectedListener Interface definition for a callback to be invoked when an item in this view has been selected. 
Known Direct Subclasses
Known Indirect Subclasses

Summary

XML Attributes inherited from class android.view.ViewGroup
XML Attributes inherited from class android.view.View

Constants

      Value  
int  SYNC_FIRST_POSITION  Sync based on the first row   0x00000001 
int  SYNC_MAX_DURATION_MILLIS  Maximum amount of time to spend in findSyncPosition()   100  0x00000064 
int  SYNC_SELECTED_POSITION  Sync based on the selected row   0x00000000 
Constants inherited from class android.view.ViewGroup
Constants inherited from class android.view.View

Fields

protected      boolean  mDataChanged  True if the data has changed since the last layout  
protected      View  mEmptyView  View to show if there is nothing in the list  
protected      int  mFirstPosition  The position of the first child displayed  
protected      boolean  mInLayout   
protected      int  mItemCount   
protected      boolean  mNeedSync  True if we need to sync to mSyncRowId  
protected      int  mNextSelectedPosition  The index within the adapter's data set of the item to select during the next layout. 
protected      long  mNextSelectedRowId  The item id of the item to select during the next layout. 
protected      OnItemClickListener  mOnItemClickListener   
protected      OnItemLongClickListener  mOnItemLongClickListener   
protected      OnItemSelectedListener  mOnItemSelectedListener   
protected      int  mSelectedPosition  The index within the adapter's data set of the currently selected item. 
protected      long  mSelectedRowId  The item id of the currently selected item. 
protected      int  mSpecificTop  The offset in pixels form the top of the AdapterView to the top of the view to select during the next layout. 
protected      int  mSyncMode  Indicates whether to sync based on the selection or position  
protected      int  mSyncPosition  Position from which to start looking for mSyncRowId  
protected      long  mSyncRowId  Row id to look for when data has changed  
Fields inherited from class android.view.ViewGroup
Fields inherited from class android.view.View

Public Constructors

          AdapterView(Context context)
          AdapterView(Context context, AttributeSet attrs, Map inflateParams)
          AdapterView(Context context, AttributeSet attrs, Map inflateParams, int defStyle)

Public Methods

        void  addView(View child, int index)
Adds a child view that already has layout parameters set on it.
        void  addView(View child, LayoutParams params)
Adds a child view with the specified layout parameters.
        void  addView(View child, int index, LayoutParams params)
Adds a child view with the specified layout parameters.
        void  addView(View child)
Adds a child view that already has layout parameters set on it.
abstract        T  getAdapter()
        int  getCount()
        View  getEmptyView()
    final    OnItemClickListener  getOnItemClickListener()
    final    OnItemLongClickListener  getOnItemLongClickListener()
    final    OnItemSelectedListener  getOnItemSelectedListener()
        int  getPositionForView(View view)
Get the position within the adapter's data set for the view, where view is a an adapter item or a descendant of an adapter item.
        Object  getSelectedItem()
        long  getSelectedItemId()
        int  getSelectedItemPosition()
Return the position of the currently selected item within the adapter's data set
abstract        View  getSelectedView()
        Object  obtainItem(int position)
Gets the data associated with the specified position in the list.
        long  obtainItemId(int position)
        boolean  performItemClick(View v, int position, long id)
Call the OnItemClickListener, if it is defined.
        void  removeAllViews()
Call this method to remove all child views from the ViewGroup.
        void  removeView(View view)
        void  removeViewAt(int index)
Removes the view at the specified position in the group.
abstract        void  setAdapter(T adapter)
        void  setEmptyView(View emptyView)
Sets the view to show if the adapter is empty
        void  setOnClickListener(OnClickListener l)
Register a callback to be invoked when this view is clicked.
        void  setOnItemClickListener(OnItemClickListener l)
Register a callback to be invoked when an item in this AdapterView has been clicked.
        void  setOnItemLongClickListener(OnItemLongClickListener l)
Register a callback to be invoked when an item in this AdapterView has been clicked and held
        void  setOnItemSelectedListener(OnItemSelectedListener l)
Register a callback to be invoked when an item in this AdapterView has been selected.
abstract        void  setSelection(int position)
Sets the currently selected item

Protected Methods

        boolean  canAnimate()
Indicates whether the view group has the ability to animate its children after the first layout.
        void  checkFocus()
        void  dispatchFreeze(SparseArray container)
Override to prevent freezing of any views created by the adapter.
        void  dispatchThaw(SparseArray container)
Override to prevent thawing of any views created by the adapter.
        int  findSyncPosition()
Searches the adapter for a position matching mSyncRowId.
        void  handleDataChanged()
        int  lookForSelectablePosition(int position, boolean lookDown)
Find a position that can be selected (i.e., is not a separator).
        void  rememberSyncState()
Remember enough information to restore the screen state when the data has changed.
        void  selectionChanged()
        void  setNextSelectedPositionInt(int position)
Utility to keep mNextSelectedPosition and mNextSelectedRowId in sync
        void  setSelectedPositionInt(int position)
Utility to keep mSelectedPosition and mSelectedRowId in sync
Methods inherited from class android.view.ViewGroup