Friday, 6 July 2012

List of Android Adapters

Month ago I first saw ResourceCursorAdapter being used in Android development.
That gave me enough curiosity to summarize them all in a single place.

There are several types which differ by data source and manipulation complexity available to the user. Lets start...

Simple adapter implementation used for ListView. You provide data by overriding required methods that provide elements for the list. Mostly used for simple list implementations.

Very useful adapter that allows us to map data to elements in the layout file. You provide a grid (two same sized arrays) which tells which element goes into which place and map that contains all the data needed for this grid to know what to put where.

For me less convenient than the SimpleAdapter since default behavior is to map String array elements to single text field. You can override it and provide an array of complex object which have data to populate more complex rows.

An easy adapter to map columns from a cursor to elements defined  in the layout file. You can specify which columns you want, which views you want to display the columns, and the layout file that defines the appearance of these views.

More sofisitcated implementation of the SimpleCursorAdapter which is abstract so its up to you
to create views with cursor providing you the data from database.

Very similar to CursorAdapter. Doesn't have a newView method which makes it more appropriate
for not so complex views. 

Haven't used this one that much but from what I've seen enables you to define two views, one with data and the second dropdown with choices.

The following two are my most favorite. They allow us to define list elements together with the groups they belong in. Very convenient for situations where you need list with grouped data. You provide both child and group views with appropriate data binding

Same as previous but with more liberty and requirements. Better for complex lists.

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.

Haven't seen this one before. Haven't seen any examples but it seems it wraps another list adapter. Strange...

Well that's all I thing....
Now I have them all in single place so I don't have to look around. Sweet :)


  1. Nice copy/paste of the documentation ..

  2. Thanks for sharing (Y) ..Must cover ExpandableListAdapter & SimpleExpandableListAdapter also..:)

  3. What adapter is more appropriate for nested listview? thanks

  4. I think ExpandableListAdapter should do the trick

  5. nice info and some of them even new for me. i have never even heard about it.

  6. Thanks for sharing about list of android adapter..Android Training in chennai

  7. Happy to see this blog i got the solution wat i needed Android Training