Javatpoint Logo
Javatpoint Logo

Android ListView

Android ListView is a view which contains the group of items and displays in a scrollable list. ListView is implemented by importing android.widget.ListView class. ListView is a default scrollable which does not use other scroll view.

ListView uses Adapter classes which add the content from data source (such as string array, array, database etc) to ListView. Adapter bridges data between an AdapterViews and other Views (ListView, ScrollView etc).

Example of ListView

Let's implement a simple listview example.

Structure of listview project

android Listview 1


First we need to drag and drop ListView component from palette to activity_main.xml file.

File: activity_main.xml

Create an additional mylist.xml file in layout folder which contains view components displayed in listview.


File: mylist.xml

Now place the list of data in strings.xml file by creating string-array.



Activity class

In java class we need to add adapter to listview using setAdapter() method of listview.



android Listview 2
android Listview 3

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA