40

Could you please tell me difference between ArrayAdapter , BaseAdapter and ListAdapter.

Kanaiya Katarmal
  • 5,974
  • 4
  • 30
  • 56

2 Answers2

51

BaseAdapter as the name suggests, is a base class for all the adapters.

When you are extending the Base adapter class you need to implement all the methods like getCount(), getId() etc.

ArrayAdapter is a class which can work with array of data. You need to override only getview() method.

ListAdapter is a an interface implemented by concrete adapter classes.

BaseAdapter is an abstract class whereas ArrayAdapter and ListAdapter are the concrete classes.

ArrayAdapter and ListAdapter classes are developed since in general we deal with the array data sets and list data sets.

Alexander Abakumov
  • 13,617
  • 16
  • 88
  • 129
Ashwin N Bhanushali
  • 3,872
  • 5
  • 39
  • 59
  • 9
    You are correct in saying that `ArrayAdapter` is a concrete class. However, `ListAdapter` is not a class, it is an interface implemented by `BaseAdapter`. In short, you could either use the ready-made `ArrayAdapter`, or write your own adapter that extends `BaseAdapter`. – Spinner Aug 22 '12 at 10:47
  • i've question, i want to use DataBase in my proje that fills with users data, and after filling ,all the items will be shown in ListView. but i don't know which of Adapter is usfull for me?ArrayAdapter or BaseAdapter? please help me. thanks – Mina Dahesh Mar 13 '15 at 16:58
  • It should be CursorAdapter please see http://developer.android.com/reference/android/widget/CursorAdapter.html – Ashwin N Bhanushali Mar 16 '15 at 06:18
48

ListAdapter

It is an interface that extended Adapter which is the bridge between a ListView and the data that backs the list.

BaseAdaper

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.

ArrayAdapter

A concrete BaseAdapter that is backed by an array of arbitrary objects.

Refer below links

  1. ListAdapter

  2. BaseAdapter

  3. ArrayAdapter

Android Killer
  • 18,174
  • 13
  • 67
  • 90
Nirali
  • 13,571
  • 6
  • 40
  • 53