This tutorial is about implementing the ListView using the ArrayAdapter in Android. The ArrayAdapter converts an array of objects into view items for the listview. So to populate a listview in Android, we use an ArrayAdapter.

How the ArrayAdapter works in Android

The ArrayAdapter is a type of adapter. An adapter helps to convert data items into Android view items. Suppose we need to align some data vertically. We need a listview to accomplish this. Let’s take the following string array:

  • This string array is passed to an ArrayAdapter.
  • The ArrayAdapter takes “pizza” as a first item and converts it to view item.
  • The pizza view item is placed as a first row in the listview.

The ArrayAdatpter has these three following arguments:

  1. Reference of the activity.
  2. The layout file for a row item in a listview.
  3. An array of objects (in this case it’s String).


Create the Android XML layout for the listview


Now create the layout file for the item which would be placed inside each row of the listview.


Now let us use Android’s ArrayAdapter to populate our listview.




I hope everything regarding the Android ArrayAdapter is clear now. If you have any suggestions or doubts, then feel free to post in the comment section below. Thank you for reading.