What is the difference between ArrayAdapter , BaseAdapter and ListAdapter

41,278

Solution 1

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.

Solution 2

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

Share:
41,278
Kanaiya Katarmal
Author by

Kanaiya Katarmal

The girl on the picture has no connection to me (it was randomly selected). This is just a test to see how many people will access my profile. On the 1-st of jan 2017 before posting this picture there were 267 who checked my profile in 4 years and 4 month. Please do not be disappointed with this test, rather up-vote my answers if you like the joke :-).

Updated on August 03, 2020

Comments

  • Kanaiya Katarmal
    Kanaiya Katarmal almost 4 years

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

  • Spinner
    Spinner over 11 years
    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
    Spinner over 11 years
    Note that ListAdapter is an interface, whereas the other two are classes that implement ListAdapter (one indirectly).
  • user1708134
    user1708134 about 11 years
    can you give an instance when will i use base and array adapter?
  • Mina Dahesh
    Mina Dahesh about 9 years
    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
  • Ashwin N Bhanushali
    Ashwin N Bhanushali about 9 years
    It should be CursorAdapter please see developer.android.com/reference/android/widget/…