ListView is a View Group that creates and manages a vertical list of Views, displaying them as rows within a list. The simplest List View displays the toString value of each object in an array, using a Text View for each item. This tutorial shows how to create a list view and launch a new activity on selecting each item in the list.

Download Project

Sample Output:
Android List View Collegewires

Start by creating a new project and extend the main activity java class from ListActivity.
Create a new XML file named list_view.xml in res->layout folder and insert the following.

We need to store all list items as string resources file. Create three new Android XML files comapnies_array.xml, apple_products.xml, and google_products.xml in res->values folder.
comapnies_array.xml

apple_products.xml

google_products.xml

Now the main activity file.
ListViewActivity.java

AppleProducts.java

GoogleProducts.java

We can directly use an string array by defining as below:

and use it as

Edit the AndroidManifest.xml as below:

List views can also be made dynamic by getting the data from a url in xml format. You have to use XML Parsing for that. Upcoming posts will cover all that. Stay tuned.