0% found this document useful (0 votes)
25 views3 pages

Saturday, January 30, 2010: Android Adapters: An Introduction

An Adapter acts as a bridge between an AdapterView like a ListView and the underlying data. The Adapter provides access to the data and is responsible for creating Views for each data item. There are several types of Adapters including ListAdapter, ArrayAdapter, CursorAdapter, and SpinnerAdapter that are used for different types of AdapterViews and data sources.

Uploaded by

John Hurt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views3 pages

Saturday, January 30, 2010: Android Adapters: An Introduction

An Adapter acts as a bridge between an AdapterView like a ListView and the underlying data. The Adapter provides access to the data and is responsible for creating Views for each data item. There are several types of Adapters including ListAdapter, ArrayAdapter, CursorAdapter, and SpinnerAdapter that are used for different types of AdapterViews and data sources.

Uploaded by

John Hurt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Saturday, January 30, 2010

Android Adapters: an introduction




An Adapter object acts as a bridge between an AdapterView and the underlying data
for that view. The Adapter provides access to the data items. The Adapter is also
responsible for making a View for each item in the data set.

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

Some examples of AdapterViews are ListView, GridView, Spinner and Gallery.

There are several types or sub-classes of Adapter:

ListAdapter: Extended Adapter that is the bridge between a ListView and the
data that backs the list. Frequently that data comes from a Cursor, but that is not
required. The ListView can display any data provided that it is wrapped in a
ListAdapter.


ArrayAdapter: A ListAdapter that manages a ListView backed by an array of
arbitrary objects. By default this class expects that the provided resource id
references a single TextView.


CursorAdapter: Adapter that exposes data from a Cursor to a ListView
widget. The Cursor must include a column named "_id" or this class will not work.


HeaderViewListAdapter: ListAdapter used when a ListView has header
views. This ListAdapter wraps another one and also keeps track of the header views
and their associated data objects.
This is intended as a base class; you will probably not need to use this class directly in
your own code.


ResourceCursorAdapter: An easy adapter that creates views defined in
an XML file. You can specify the XML file that defines the appearance of the views.


SimpleAdapter: An easy adapter to map static data to views defined in an
XML file. You can specify the data backing the list as an ArrayList of Maps. Each entry
in the ArrayList corresponds to one row in the list.


SimpleCursorAdapter: An easy adapter to map columns from a cursor to
TextViews or ImageViews defined in an XML file. You can specify which columns you
want, which views you want to display the columns, and the XML file that defines the
appearance of these views.


SpinnerAdapter: 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.


WrapperListAdapter: List adapter that wraps another list adapter. The
wrapped adapter can be retrieved by calling getWrappedAdapter().

You might also like