Android ListView Tutorial with Example

By | May 30, 2019
ListView in Android Example Tutorial

What is ListView in Android ?

ListView is a view of group of item that contain scrollable list . ListView is a default scrollable which does not use other scroll view. ListView items are automatically inserted in list using an Adapter that pulls content from a source such as an array or database.

ListView is a one of the basic and most used UI components of android. The most common usages include displaying data in the form of a vertical scrolling list. ListView is used to ArrayAdapter class.

What is ArrayAdapter in ListView Android And How to use ArrayAdapter?

ArrayAdapter is a Bridge between UI and data.It is used to fill data in UI Component. This adapter when your data source is an array. ArrayAdapter creates a view for each array item by calling toString() on each item. An adapter is used for managing the items in the list .

Adapter are holds the data and send the data to adapter view, the view can take the data from adapter view and shows the data on different views like as spinner, list view, grid view etc.

How to Create ListView in Android ?

Create activity_main.xml file Following below the code.

Create MainActivity.java File Following below the code.

Above the example of Implement ListView tag in xml file and then create string array of MainActivity.java file now this array store to android version name and set the listview ArrayAdapter and then set click listener in listview. when user can select item to display message of version name.