Android Widget – List View “how to add the items/values to the list view in android”

Android Widget – ListView “how to add the items/values to the listview in android”  from XIC-Coimbatore

In your ADT tool create a new Android Application name as ListViewExample.

Open activity_main.xml drag and drop the ListView widget from composite tab.


click tab to page. Create a global object for the ListView as lv_item.

Inside the onCreate method use findviewbyid method to connect with the ListView widget xml page to the java page like follow

lv_item=(ListView) findViewById(;


Now manually add the details for the ListView. Using Array list we can create the group of items. These things have to attach into ListView for that we need adapter like ArrayAdapter.

Create Array list and Array Adapter instance object.


String itlist[] = {“Microsoft”,”IBM”,”XIC”,”BOSCH”,”Google”,”TCS”};


ArrayAdapter<String> adpt;


then set the list item to the adapter.


adpt = new ArrayAdapter<String>(MainActivity.this,   android.R.layout.simple_list_item_1, itlist);


finally set the adapter object to listview event.




above steps are load the list items into the ListView widget. User can view or select any item from Listview. If array object added more values means it automatically inherits scrollview to the list.


Sample Demo Input :

Output Screen

For More Android Application Event kindly visit our Blog page.

0 responses on "Android Widget – List View “how to add the items/values to the list view in android”"

Leave a Message

Your email address will not be published. Required fields are marked *

About Xplore IT Corp

XIC is home to several global certified trainers who are subject matter experts in their respective domains. XIC has Vast experienced resources who are top experts including that of Microsoft, Cisco, Oracle, VMware, Red Hat, Novell, EC Council, Adobe, among others.

© Xplore IT Corp 2017. All rights reserved. Designed by Web Design Company
Xplore WhatsApp Chat
Send via WhatsApp