Build 1.0_r1(from source)

android.widget
Class AdapterView<T extends Adapter>

java.lang.Object
  extended by android.view.View
      extended by android.view.ViewGroup
          extended by android.widget.AdapterView<T>
All Implemented Interfaces:
Drawable.Callback, KeyEvent.Callback, ViewManager, ViewParent
Direct Known Subclasses:
AbsListView, AbsSpinner

public abstract class AdapterView<T extends Adapter>
extends ViewGroup

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

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


Nested Class Summary
static class AdapterView.AdapterContextMenuInfo
          Extra menu information provided to the android.view.View.OnCreateContextMenuListener#onCreateContextMenu(ContextMenu, View, ContextMenuInfo) callback when a context menu is brought up for this AdapterView.
(package private)  class AdapterView.AdapterDataSetObserver
           
static interface AdapterView.OnItemClickListener
          Interface definition for a callback to be invoked when an item in this AdapterView has been clicked.
static interface AdapterView.OnItemLongClickListener
          Interface definition for a callback to be invoked when an item in this view has been clicked and held.
static interface AdapterView.OnItemSelectedListener
          Interface definition for a callback to be invoked when an item in this view has been selected.
 
Nested classes/interfaces inherited from class android.view.ViewGroup
ViewGroup.LayoutParams, ViewGroup.MarginLayoutParams, ViewGroup.OnHierarchyChangeListener
 
Nested classes/interfaces inherited from class android.view.View
View.BaseSavedState, View.MeasureSpec, View.OnClickListener, View.OnCreateContextMenuListener, View.OnFocusChangeListener, View.OnKeyListener, View.OnLongClickListener, View.OnTouchListener
 
Field Summary
static int INVALID_POSITION
          Represents an invalid position.
static long INVALID_ROW_ID
          Represents an empty or invalid row id
static int ITEM_VIEW_TYPE_HEADER_OR_FOOTER
          The item view type returned by Adapter.getItemViewType(int) when the item is a header or footer.
static int ITEM_VIEW_TYPE_IGNORE
          The item view type returned by Adapter.getItemViewType(int) when the adapter does not want the item's view recycled.
(package private)  boolean mBlockLayoutRequests
          When set to true, calls to requestLayout() will not propagate up the parent hierarchy.
(package private)  boolean mDataChanged
          True if the data has changed since the last layout
(package private)  View mEmptyView
          View to show if there are no items to show.
(package private)  int mFirstPosition
          The position of the first child displayed
(package private)  boolean mInLayout
          Indicates that this view is currently being laid out.
(package private)  int mItemCount
          The number of items in the current adapter.
(package private)  boolean mNeedSync
          True if we need to sync to mSyncRowId
(package private)  int mNextSelectedPosition
          The position within the adapter's data set of the item to select during the next layout.
(package private)  long mNextSelectedRowId
          The item id of the item to select during the next layout.
(package private)  int mOldItemCount
          The number of items in the adapter before a data changed event occured.
(package private)  int mOldSelectedPosition
          The last selected position we used when notifying
(package private)  long mOldSelectedRowId
          The id of the last selected position we used when notifying
(package private)  AdapterView.OnItemClickListener mOnItemClickListener
          The listener that receives notifications when an item is clicked.
(package private)  AdapterView.OnItemLongClickListener mOnItemLongClickListener
          The listener that receives notifications when an item is long clicked.
(package private)  AdapterView.OnItemSelectedListener mOnItemSelectedListener
          The listener that receives notifications when an item is selected.
(package private)  int mSelectedPosition
          The position within the adapter's data set of the currently selected item.
(package private)  long mSelectedRowId
          The item id of the currently selected item.
(package private)  int mSpecificTop
          The offset in pixels from the top of the AdapterView to the top of the view to select during the next layout.
(package private)  long mSyncHeight
          Height of the view when mSyncPosition and mSyncRowId where set
(package private)  int mSyncMode
          Indicates whether to sync based on the selection or position.
(package private)  int mSyncPosition
          Position from which to start looking for mSyncRowId
(package private)  long mSyncRowId
          Row id to look for when data has changed
(package private) static int SYNC_FIRST_POSITION
          Sync based on the first child displayed
(package private) static int SYNC_MAX_DURATION_MILLIS
          Maximum amount of time to spend in findSyncPosition()
(package private) static int SYNC_SELECTED_POSITION
          Sync based on the selected child
 
Fields inherited from class android.view.ViewGroup
CLIP_TO_PADDING_MASK, FLAG_SUPPORT_STATIC_TRANSFORMATIONS, FLAG_USE_CHILD_DRAWING_ORDER, FOCUS_AFTER_DESCENDANTS, FOCUS_BEFORE_DESCENDANTS, FOCUS_BLOCK_DESCENDANTS, mDisappearingChildren, mGroupFlags, mOnHierarchyChangeListener, mPersistentDrawingCache, PERSISTENT_ALL_CACHES, PERSISTENT_ANIMATION_CACHE, PERSISTENT_NO_CACHE, PERSISTENT_SCROLLING_CACHE
 
Fields inherited from class android.view.View
DRAWING_CACHE_QUALITY_AUTO, DRAWING_CACHE_QUALITY_HIGH, DRAWING_CACHE_QUALITY_LOW, EMPTY_STATE_SET, ENABLED_FOCUSED_SELECTED_STATE_SET, ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_FOCUSED_STATE_SET, ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, ENABLED_SELECTED_STATE_SET, ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_STATE_SET, ENABLED_WINDOW_FOCUSED_STATE_SET, FIRST_STATE_SET, FOCUS_BACKWARD, FOCUS_DOWN, FOCUS_FORWARD, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_UP, FOCUSED_SELECTED_STATE_SET, FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, FOCUSED_STATE_SET, FOCUSED_WINDOW_FOCUSED_STATE_SET, GONE, INVISIBLE, KEEP_SCREEN_ON, LAST_STATE_SET, mBottom, mContext, mCurrentAnimation, MIDDLE_STATE_SET, mLayoutParams, mLeft, mLocation, mMeasuredHeight, mMeasuredWidth, mOnClickListener, mOnCreateContextMenuListener, mOnFocusChangeListener, mOnLongClickListener, mPaddingBottom, mPaddingLeft, mPaddingRight, mPaddingTop, mParent, mRight, mScrollX, mScrollY, mTag, mTop, NO_ID, PRESSED_ENABLED_FOCUSED_SELECTED_STATE_SET, PRESSED_ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_SELECTED_STATE_SET, PRESSED_ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_STATE_SET, PRESSED_ENABLED_WINDOW_FOCUSED_STATE_SET, PRESSED_FIRST_STATE_SET, PRESSED_FOCUSED_SELECTED_STATE_SET, PRESSED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_STATE_SET, PRESSED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_LAST_STATE_SET, PRESSED_MIDDLE_STATE_SET, PRESSED_SELECTED_STATE_SET, PRESSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_SINGLE_STATE_SET, PRESSED_STATE_SET, PRESSED_WINDOW_FOCUSED_STATE_SET, SCROLLBARS_INSIDE_INSET, SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_OUTSIDE_INSET, SCROLLBARS_OUTSIDE_OVERLAY, SELECTED_STATE_SET, SELECTED_WINDOW_FOCUSED_STATE_SET, SINGLE_STATE_SET, SOUND_EFFECTS_ENABLED, VIEW_LOG_TAG, VISIBLE, WINDOW_FOCUSED_STATE_SET
 
Constructor Summary
AdapterView(Context context)
           
AdapterView(Context context, AttributeSet attrs)
           
AdapterView(Context context, AttributeSet attrs, int defStyle)
           
 
Method Summary
 void addView(View child)
          This method is not supported and throws an UnsupportedOperationException when called.
 void addView(View child, int index)
          This method is not supported and throws an UnsupportedOperationException when called.
 void addView(View child, int index, ViewGroup.LayoutParams params)
          This method is not supported and throws an UnsupportedOperationException when called.
 void addView(View child, ViewGroup.LayoutParams params)
          This method is not supported and throws an UnsupportedOperationException when called.
protected  boolean canAnimate()
          Indicates whether the view group has the ability to animate its children after the first layout.
(package private)  void checkFocus()
           
(package private)  void checkSelectionChanged()
           
protected  void dispatchRestoreInstanceState(SparseArray<Parcelable> container)
          Override to prevent thawing of any views created by the adapter.
protected  void dispatchSaveInstanceState(SparseArray<Parcelable> container)
          Override to prevent freezing of any views created by the adapter.
(package private)  int findSyncPosition()
          Searches the adapter for a position matching mSyncRowId.
abstract  T getAdapter()
          Returns the adapter currently associated with this widget.
 int getCount()
           
 View getEmptyView()
          When the current adapter is empty, the AdapterView can display a special view call the empty view.
 int getFirstVisiblePosition()
          Returns the position within the adapter's data set for the first item displayed on screen.
 Object getItemAtPosition(int position)
          Gets the data associated with the specified position in the list.
 long getItemIdAtPosition(int position)
           
 int getLastVisiblePosition()
          Returns the position within the adapter's data set for the last item displayed on screen.
 AdapterView.OnItemClickListener getOnItemClickListener()
           
 AdapterView.OnItemLongClickListener getOnItemLongClickListener()
           
 AdapterView.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()
           
(package private)  void handleDataChanged()
           
(package private)  boolean isInFilterMode()
          Indicates whether this view is in filter mode.
(package private)  int lookForSelectablePosition(int position, boolean lookDown)
          Find a position that can be selected (i.e., is not a separator).
protected  void onLayout(boolean changed, int left, int top, int right, int bottom)
          Called from layout when this view should assign a size and position to each of its children.
 boolean performItemClick(View view, int position, long id)
          Call the OnItemClickListener, if it is defined.
(package private)  void rememberSyncState()
          Remember enough information to restore the screen state when the data has changed.
 void removeAllViews()
          This method is not supported and throws an UnsupportedOperationException when called.
 void removeView(View child)
          This method is not supported and throws an UnsupportedOperationException when called.
 void removeViewAt(int index)
          This method is not supported and throws an UnsupportedOperationException when called.
(package private)  void selectionChanged()
           
abstract  void setAdapter(T adapter)
          Sets the adapter that provides the data and the views to represent the data in this widget.
 void setEmptyView(View emptyView)
          Sets the view to show if the adapter is empty
 void setFocusable(boolean focusable)
          Set whether this view can receive the focus.
 void setFocusableInTouchMode(boolean focusable)
          Set whether this view can receive focus while in touch mode.
(package private)  void setNextSelectedPositionInt(int position)
          Utility to keep mNextSelectedPosition and mNextSelectedRowId in sync
 void setOnClickListener(View.OnClickListener l)
          Register a callback to be invoked when this view is clicked.
 void setOnItemClickListener(AdapterView.OnItemClickListener listener)
          Register a callback to be invoked when an item in this AdapterView has been clicked.
 void setOnItemLongClickListener(AdapterView.OnItemLongClickListener listener)
          Register a callback to be invoked when an item in this AdapterView has been clicked and held
 void setOnItemSelectedListener(AdapterView.OnItemSelectedListener listener)
          Register a callback to be invoked when an item in this AdapterView has been selected.
(package private)  void setSelectedPositionInt(int position)
          Utility to keep mSelectedPosition and mSelectedRowId in sync
abstract  void setSelection(int position)
          Sets the currently selected item
 
Methods inherited from class android.view.ViewGroup
addFocusables, addStatesFromChildren, addTouchables, addView, addViewInLayout, addViewInLayout, attachLayoutAnimationParameters, attachViewToParent, bringChildToFront, checkLayoutParams, childDrawableStateChanged, cleanupLayoutState, clearChildFocus, clearDisappearingChildren, clearFocus, debug, detachAllViewsFromParent, detachViewFromParent, detachViewFromParent, detachViewsFromParent, dispatchDraw, dispatchFreezeSelfOnly, dispatchKeyEvent, dispatchSetPressed, dispatchSetSelected, dispatchThawSelfOnly, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchWindowFocusChanged, dispatchWindowVisibilityChanged, drawableStateChanged, drawChild, findFocus, findViewTraversal, findViewWithTagTraversal, fitSystemWindows, focusableViewAvailable, focusSearch, gatherTransparentRegion, generateDefaultLayoutParams, generateLayoutParams, generateLayoutParams, getChildAt, getChildCount, getChildDrawingOrder, getChildMeasureSpec, getChildStaticTransformation, getChildVisibleRect, getDescendantFocusability, getFocusedChild, getLayoutAnimation, getLayoutAnimationListener, getPersistentDrawingCache, hasFocus, hasFocusable, indexOfChild, invalidateChild, invalidateChildInParent, isAlwaysDrawnWithCacheEnabled, isAnimationCacheEnabled, isChildrenDrawnWithCacheEnabled, measureChild, measureChildren, measureChildWithMargins, offsetChildrenTopAndBottom, offsetDescendantRectToMyCoords, offsetRectIntoDescendantCoords, onAnimationEnd, onAnimationStart, onCreateDrawableState, onInterceptTouchEvent, onRequestFocusInDescendants, recomputeViewAttributes, removeAllViewsInLayout, removeDetachedView, removeViewInLayout, removeViews, removeViewsInLayout, requestChildFocus, requestChildRectangleOnScreen, requestDisallowInterceptTouchEvent, requestFocus, requestTransparentRegion, scheduleLayoutAnimation, setAddStatesFromChildren, setAlwaysDrawnWithCacheEnabled, setAnimationCacheEnabled, setChildrenDrawingCacheEnabled, setChildrenDrawnWithCacheEnabled, setClipChildren, setClipToPadding, setDescendantFocusability, setLayoutAnimation, setLayoutAnimationListener, setOnHierarchyChangeListener, setPadding, setPersistentDrawingCache, showContextMenuForChild, startLayoutAnimation, updateViewLayout
 
Methods inherited from class android.view.View
applyDrawableToTransparentRegion, bringToFront, buildDrawingCache, cancelLongPress, clearAnimation, computeHorizontalScrollExtent, computeHorizontalScrollOffset, computeHorizontalScrollRange, computeScroll, computeVerticalScrollExtent, computeVerticalScrollOffset, computeVerticalScrollRange, createContextMenu, debug, debugIndent, destroyDrawingCache, dispatchKeyShortcutEvent, draw, finalize, findViewById, findViewWithTag, focusSearch, forceLayout, getAnimation, getApplicationWindowToken, getBackground, getBaseline, getBottom, getBottomFadingEdgeStrength, getContext, getContextMenuInfo, getDefaultSize, getDrawableState, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getFocusables, getFocusedRect, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getId, getKeepScreenOn, getLayoutParams, getLeft, getLeftFadingEdgeStrength, getLocalVisibleRect, getLocationInWindow, getLocationOnScreen, getMeasuredHeight, getMeasuredWidth, getNextFocusDownId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, getParent, getResources, getRight, getRightFadingEdgeStrength, getRootView, getScrollBarStyle, getScrollX, getScrollY, getSolidColor, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getTag, getTop, getTopFadingEdgeStrength, getTouchables, getTouchDelegate, getVerticalFadingEdgeLength, getVerticalScrollbarWidth, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowToken, getWindowVisibility, hasWindowFocus, inflate, initializeFadingEdge, initializeScrollbars, invalidate, invalidate, invalidate, invalidateDrawable, isClickable, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isInTouchMode, isLayoutRequested, isLongClickable, isPressed, isRootNamespace, isSaveEnabled, isSelected, isShown, isSoundEffectsEnabled, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, layout, measure, mergeDrawableStates, offsetLeftAndRight, offsetTopAndBottom, onAttachedToWindow, onCreateContextMenu, onDetachedFromWindow, onDraw, onFinishInflate, onFocusChanged, onKeyDown, onKeyMultiple, onKeyShortcut, onKeyUp, onMeasure, onRestoreInstanceState, onSaveInstanceState, onScrollChanged, onSetAlpha, onSizeChanged, onTouchEvent, onTrackballEvent, onWindowFocusChanged, onWindowVisibilityChanged, performClick, performLongClick, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, refreshDrawableState, removeCallbacks, requestFocus, requestFocus, requestFocusFromTouch, requestLayout, requestRectangleOnScreen, requestRectangleOnScreen, resolveSize, restoreHierarchyState, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, setAnimation, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setClickable, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setEnabled, setFadingEdgeLength, setFrame, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setId, setIsRootNamespace, setKeepScreenOn, setLayoutParams, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNextFocusDownId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnCreateContextMenuListener, setOnFocusChangeListener, setOnKeyListener, setOnLongClickListener, setOnTouchListener, setPressed, setSaveEnabled, setScrollBarStyle, setSelected, setSoundEffectsEnabled, setTag, setTouchDelegate, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVisibility, setWillNotCacheDrawing, setWillNotDraw, showContextMenu, startAnimation, unscheduleDrawable, unscheduleDrawable, verifyDrawable, willNotCacheDrawing, willNotDraw
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface android.view.ViewParent
createContextMenu, getParent, isLayoutRequested, requestLayout
 

Field Detail

ITEM_VIEW_TYPE_IGNORE

public static final int ITEM_VIEW_TYPE_IGNORE
The item view type returned by Adapter.getItemViewType(int) when the adapter does not want the item's view recycled.

See Also:
Constant Field Values

ITEM_VIEW_TYPE_HEADER_OR_FOOTER

public static final int ITEM_VIEW_TYPE_HEADER_OR_FOOTER
The item view type returned by Adapter.getItemViewType(int) when the item is a header or footer.

See Also:
Constant Field Values

mFirstPosition

int mFirstPosition
The position of the first child displayed


mSpecificTop

int mSpecificTop
The offset in pixels from the top of the AdapterView to the top of the view to select during the next layout.


mSyncPosition

int mSyncPosition
Position from which to start looking for mSyncRowId


mSyncRowId

long mSyncRowId
Row id to look for when data has changed


mSyncHeight

long mSyncHeight
Height of the view when mSyncPosition and mSyncRowId where set


mNeedSync

boolean mNeedSync
True if we need to sync to mSyncRowId


mSyncMode

int mSyncMode
Indicates whether to sync based on the selection or position. Possible values are SYNC_SELECTED_POSITION or SYNC_FIRST_POSITION.


SYNC_SELECTED_POSITION

static final int SYNC_SELECTED_POSITION
Sync based on the selected child

See Also:
Constant Field Values

SYNC_FIRST_POSITION

static final int SYNC_FIRST_POSITION
Sync based on the first child displayed

See Also:
Constant Field Values

SYNC_MAX_DURATION_MILLIS

static final int SYNC_MAX_DURATION_MILLIS
Maximum amount of time to spend in findSyncPosition()

See Also:
Constant Field Values

mInLayout

boolean mInLayout
Indicates that this view is currently being laid out.


mOnItemSelectedListener

AdapterView.OnItemSelectedListener mOnItemSelectedListener
The listener that receives notifications when an item is selected.


mOnItemClickListener

AdapterView.OnItemClickListener mOnItemClickListener
The listener that receives notifications when an item is clicked.


mOnItemLongClickListener

AdapterView.OnItemLongClickListener mOnItemLongClickListener
The listener that receives notifications when an item is long clicked.


mDataChanged

boolean mDataChanged
True if the data has changed since the last layout


mNextSelectedPosition

int mNextSelectedPosition
The position within the adapter's data set of the item to select during the next layout.


mNextSelectedRowId

long mNextSelectedRowId
The item id of the item to select during the next layout.


mSelectedPosition

int mSelectedPosition
The position within the adapter's data set of the currently selected item.


mSelectedRowId

long mSelectedRowId
The item id of the currently selected item.


mEmptyView

View mEmptyView
View to show if there are no items to show.


mItemCount

int mItemCount
The number of items in the current adapter.


mOldItemCount

int mOldItemCount
The number of items in the adapter before a data changed event occured.


INVALID_POSITION

public static final int INVALID_POSITION
Represents an invalid position. All valid positions are in the range 0 to 1 less than the number of items in the current adapter.

See Also:
Constant Field Values

INVALID_ROW_ID

public static final long INVALID_ROW_ID
Represents an empty or invalid row id

See Also:
Constant Field Values

mOldSelectedPosition

int mOldSelectedPosition
The last selected position we used when notifying


mOldSelectedRowId

long mOldSelectedRowId
The id of the last selected position we used when notifying


mBlockLayoutRequests

boolean mBlockLayoutRequests
When set to true, calls to requestLayout() will not propagate up the parent hierarchy. This is used to layout the children during a layout pass.

Constructor Detail

AdapterView

public AdapterView(Context context)

AdapterView

public AdapterView(Context context,
                   AttributeSet attrs)

AdapterView

public AdapterView(Context context,
                   AttributeSet attrs,
                   int defStyle)
Method Detail

setOnItemClickListener

public void setOnItemClickListener(AdapterView.OnItemClickListener listener)
Register a callback to be invoked when an item in this AdapterView has been clicked.

Parameters:
listener - The callback that will be invoked.

getOnItemClickListener

public final AdapterView.OnItemClickListener getOnItemClickListener()
Returns:
The callback to be invoked with an item in this AdapterView has been clicked, or null id no callback has been set.

performItemClick

public boolean performItemClick(View view,
                                int position,
                                long id)
Call the OnItemClickListener, if it is defined.

Parameters:
view - The view within the AdapterView that was clicked.
position - The position of the view in the adapter.
id - The row id of the item that was clicked.
Returns:
True if there was an assigned OnItemClickListener that was called, false otherwise is returned.

setOnItemLongClickListener

public void setOnItemLongClickListener(AdapterView.OnItemLongClickListener listener)
Register a callback to be invoked when an item in this AdapterView has been clicked and held

Parameters:
listener - The callback that will run

getOnItemLongClickListener

public final AdapterView.OnItemLongClickListener getOnItemLongClickListener()
Returns:
The callback to be invoked with an item in this AdapterView has been clicked and held, or null id no callback as been set.

setOnItemSelectedListener

public void setOnItemSelectedListener(AdapterView.OnItemSelectedListener listener)
Register a callback to be invoked when an item in this AdapterView has been selected.

Parameters:
listener - The callback that will run

getOnItemSelectedListener

public final AdapterView.OnItemSelectedListener getOnItemSelectedListener()

getAdapter

public abstract T getAdapter()
Returns the adapter currently associated with this widget.

Returns:
The adapter used to provide this view's content.

setAdapter

public abstract void setAdapter(T adapter)
Sets the adapter that provides the data and the views to represent the data in this widget.

Parameters:
adapter - The adapter to use to create this view's content.

addView

public void addView(View child)
This method is not supported and throws an UnsupportedOperationException when called.

Overrides:
addView in class ViewGroup
Parameters:
child - Ignored.
Throws:
UnsupportedOperationException - Every time this method is invoked.
See Also:
ViewGroup.generateDefaultLayoutParams()

addView

public void addView(View child,
                    int index)
This method is not supported and throws an UnsupportedOperationException when called.

Overrides:
addView in class ViewGroup
Parameters:
child - Ignored.
index - Ignored.
Throws:
UnsupportedOperationException - Every time this method is invoked.
See Also:
ViewGroup.generateDefaultLayoutParams()

addView

public void addView(View child,
                    ViewGroup.LayoutParams params)
This method is not supported and throws an UnsupportedOperationException when called.

Specified by:
addView in interface ViewManager
Overrides:
addView in class ViewGroup
Parameters:
child - Ignored.
params - Ignored.
Throws:
UnsupportedOperationException - Every time this method is invoked.

addView

public void addView(View child,
                    int index,
                    ViewGroup.LayoutParams params)
This method is not supported and throws an UnsupportedOperationException when called.

Overrides:
addView in class ViewGroup
Parameters:
child - Ignored.
index - Ignored.
params - Ignored.
Throws:
UnsupportedOperationException - Every time this method is invoked.

removeView

public void removeView(View child)
This method is not supported and throws an UnsupportedOperationException when called.

Specified by:
removeView in interface ViewManager
Overrides:
removeView in class ViewGroup
Parameters:
child - Ignored.
Throws:
UnsupportedOperationException - Every time this method is invoked.

removeViewAt

public void removeViewAt(int index)
This method is not supported and throws an UnsupportedOperationException when called.

Overrides:
removeViewAt in class ViewGroup
Parameters:
index - Ignored.
Throws:
UnsupportedOperationException - Every time this method is invoked.

removeAllViews

public void removeAllViews()
This method is not supported and throws an UnsupportedOperationException when called.

Overrides:
removeAllViews in class ViewGroup
Throws:
UnsupportedOperationException - Every time this method is invoked.

onLayout

protected void onLayout(boolean changed,
                        int left,
                        int top,
                        int right,
                        int bottom)
Description copied from class: ViewGroup
Called from layout when this view should assign a size and position to each of its children. Derived classes with children should override this method and call layout on each of their their children.

Specified by:
onLayout in class ViewGroup
Parameters:
changed - This is a new size or position for this view
left - Left position, relative to parent
top - Top position, relative to parent
right - Right position, relative to parent
bottom - Bottom position, relative to parent

getSelectedItemPosition

public int getSelectedItemPosition()
Return the position of the currently selected item within the adapter's data set

Returns:
int Position (starting at 0), or INVALID_POSITION if there is nothing selected.

getSelectedItemId

public long getSelectedItemId()
Returns:
The id corresponding to the currently selected item, or INVALID_ROW_ID if nothing is selected.

getSelectedView

public abstract View getSelectedView()
Returns:
The view corresponding to the currently selected item, or null if nothing is selected

getSelectedItem

public Object getSelectedItem()
Returns:
The data corresponding to the currently selected item, or null if there is nothing selected.

getCount

public int getCount()
Returns:
The number of items owned by the Adapter associated with this AdapterView. (This is the number of data items, which may be larger than the number of visible view.)

getPositionForView

public 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.

Parameters:
view - an adapter item, or a descendant of an adapter item. This must be visible in this AdapterView at the time of the call.
Returns:
the position within the adapter's data set of the view, or INVALID_POSITION if the view does not correspond to a list item (or it is not currently visible).

getFirstVisiblePosition

public int getFirstVisiblePosition()
Returns the position within the adapter's data set for the first item displayed on screen.

Returns:
The position within the adapter's data set

getLastVisiblePosition

public int getLastVisiblePosition()
Returns the position within the adapter's data set for the last item displayed on screen.

Returns:
The position within the adapter's data set

setSelection

public abstract void setSelection(int position)
Sets the currently selected item

Parameters:
position - Index (starting at 0) of the data item to be selected.

setEmptyView

public void setEmptyView(View emptyView)
Sets the view to show if the adapter is empty


getEmptyView

public View getEmptyView()
When the current adapter is empty, the AdapterView can display a special view call the empty view. The empty view is used to provide feedback to the user that no data is available in this AdapterView.

Returns:
The view to show if the adapter is empty.

isInFilterMode

boolean isInFilterMode()
Indicates whether this view is in filter mode. Filter mode can for instance be enabled by a user when typing on the keyboard.

Returns:
True if the view is in filter mode, false otherwise.

setFocusable

public void setFocusable(boolean focusable)
Description copied from class: View
Set whether this view can receive the focus. Setting this to false will also ensure that this view is not focusable in touch mode.

Overrides:
setFocusable in class View
Parameters:
focusable - If true, this view can receive the focus.
See Also:
View.setFocusableInTouchMode(boolean)

setFocusableInTouchMode

public void setFocusableInTouchMode(boolean focusable)
Description copied from class: View
Set whether this view can receive focus while in touch mode. Setting this to true will also ensure that this view is focusable.

Overrides:
setFocusableInTouchMode in class View
Parameters:
focusable - If true, this view can receive the focus while in touch mode.
See Also:
View.setFocusable(boolean)

checkFocus

void checkFocus()

getItemAtPosition

public Object getItemAtPosition(int position)
Gets the data associated with the specified position in the list.

Parameters:
position - Which data to get
Returns:
The data associated with the specified position in the list

getItemIdAtPosition

public long getItemIdAtPosition(int position)

setOnClickListener

public void setOnClickListener(View.OnClickListener l)
Description copied from class: View
Register a callback to be invoked when this view is clicked. If this view is not clickable, it becomes clickable.

Overrides:
setOnClickListener in class View
Parameters:
l - The callback that will run
See Also:
View.setClickable(boolean)

dispatchSaveInstanceState

protected void dispatchSaveInstanceState(SparseArray<Parcelable> container)
Override to prevent freezing of any views created by the adapter.

Overrides:
dispatchSaveInstanceState in class ViewGroup
Parameters:
container - The SparseArray in which to save the view's state.
See Also:
View.dispatchRestoreInstanceState(android.util.SparseArray), View.saveHierarchyState(android.util.SparseArray), View.onSaveInstanceState()

dispatchRestoreInstanceState

protected void dispatchRestoreInstanceState(SparseArray<Parcelable> container)
Override to prevent thawing of any views created by the adapter.

Overrides:
dispatchRestoreInstanceState in class ViewGroup
Parameters:
container - The SparseArray which holds previously saved state.
See Also:
View.dispatchSaveInstanceState(android.util.SparseArray), View.restoreHierarchyState(android.util.SparseArray), View.onRestoreInstanceState(android.os.Parcelable)

selectionChanged

void selectionChanged()

canAnimate

protected boolean canAnimate()
Description copied from class: ViewGroup
Indicates whether the view group has the ability to animate its children after the first layout.

Overrides:
canAnimate in class ViewGroup
Returns:
true if the children can be animated, false otherwise

handleDataChanged

void handleDataChanged()

checkSelectionChanged

void checkSelectionChanged()

findSyncPosition

int findSyncPosition()
Searches the adapter for a position matching mSyncRowId. The search starts at mSyncPosition and then alternates between moving up and moving down until 1) we find the right position, or 2) we run out of time, or 3) we have looked at every position

Returns:
Position of the row that matches mSyncRowId, or INVALID_POSITION if it can't be found

lookForSelectablePosition

int lookForSelectablePosition(int position,
                              boolean lookDown)
Find a position that can be selected (i.e., is not a separator).

Parameters:
position - The starting position to look at.
lookDown - Whether to look down for other positions.
Returns:
The next selectable position starting at position and then searching either up or down. Returns INVALID_POSITION if nothing can be found.

setSelectedPositionInt

void setSelectedPositionInt(int position)
Utility to keep mSelectedPosition and mSelectedRowId in sync

Parameters:
position - Our current position

setNextSelectedPositionInt

void setNextSelectedPositionInt(int position)
Utility to keep mNextSelectedPosition and mNextSelectedRowId in sync

Parameters:
position - Intended value for mSelectedPosition the next time we go through layout

rememberSyncState

void rememberSyncState()
Remember enough information to restore the screen state when the data has changed.


Build 1.0_r1(from source)

Please submit a feedback, bug or feature