A ListView in android is used to list out all the values at one place.

 

In this tutorial i will show a list of colors and a toast displayed when clicked on the listview with selected color

Here in this tutorial i am showing you the basic listview tutorial.

 

Populating listview based on String [] list values.

 

String[] values = new String[] { “Red Color”, “Blue Color”,“Green Color”, “Yellow Color”, “Violet Color”,”Purple Color” };

 

MainActivity.java

 

Add a listview in layout and also a textview.

activity_main.xml

 

AndroidManifest.xml

 

Output:

list1

list2

Show Buttons
Hide Buttons
Read previous post:
Android Tutorial on Simple Login

Close