SpinnerAdapter


public interface SpinnerAdapter
implements Adapter

android.widget.SpinnerAdapter
ArrayAdapter<T> You can use this adapter to provide views for an AdapterView, Returns a view for each object in a collection of data objects you provide, and can be used with list-based user interface widgets such as ListView or Spinner
BaseAdapter Common base class of common implementation for an Adapter that can be used in both ListView (by implementing the specialized ListAdapter interface) and Spinner (by implementing the specialized SpinnerAdapter interface). 
CursorAdapter Adapter that exposes data from a Cursor to a ListView widget. 
ResourceCursorAdapter An easy adapter that creates views defined in an XML file. 
SimpleAdapter An easy adapter to map static data to views defined in an XML file. 
SimpleCursorAdapter An easy adapter to map columns from a cursor to TextViews or ImageViews defined in an XML file. 
ThemedSpinnerAdapter An extension of SpinnerAdapter that is capable of inflating drop-down views against a different theme than normal views. 


Extended Adapter that is the bridge between a Spinner and its data. A spinner adapter allows to define two different views: one that shows the data in the spinner itself and one that shows the data in the drop down list when the spinner is pressed.

Summary

Inherited constants

int IGNORE_ITEM_VIEW_TYPE

An item view type that causes the AdapterView to ignore the item view.

int NO_SELECTION

Public methods

abstract View getDropDownView(int position, View convertView, ViewGroup parent)

Gets a View that displays in the drop down popup the data at the specified position in the data set.

Inherited methods

default CharSequence[] getAutofillOptions()

Gets a string representation of the adapter data that can help AutofillService autofill the view backed by the adapter.

abstract int getCount()

How many items are in the data set represented by this Adapter.

abstract Object getItem(int position)

Get the data item associated with the specified position in the data set.

abstract long getItemId(int position)

Get the row id associated with the specified position in the list.

abstract int getItemViewType(int position)

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

abstract View getView(int position, View convertView, ViewGroup parent)

Get a View that displays the data at the specified position in the data set.

abstract int getViewTypeCount()

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

abstract boolean hasStableIds()

Indicates whether the item ids are stable across changes to the underlying data.

abstract boolean isEmpty()
abstract void registerDataSetObserver(DataSetObserver observer)

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

abstract void unregisterDataSetObserver(DataSetObserver observer)

Unregister an observer that has previously been registered with this adapter via registerDataSetObserver(DataSetObserver).

Public methods

getDropDownView

Added in API level 1
public abstract View getDropDownView (int position, 
                View convertView, 
                ViewGroup parent)

Gets a View that displays in the drop down popup the data at the specified position in the data set.

Parameters
position int: index of the item whose view we want.

convertView View: the old view to reuse, if possible. Note: You should check that this view is non-null and of an appropriate type before using. If it is not possible to convert this view to display the correct data, this method can create a new view.

parent ViewGroup: the parent that this view will eventually be attached to

Returns
View a View corresponding to the data at the specified position.