Saturday, 15 November 2014

What is ListView in Android ?

- ListView is a Collection or a list of Views.

- ListView requires a class which converts the Array Objects into the ListView understandable format
(View) which is called as Adapter.

- ArrayAdapter is a SubClass of  BaseAdapter which is used for converting an Array into ListView
understandable form(View).

To Create ArrayAdapter following parameters are required :

-Context :  this

-textViewResourceID : the XML file from where the ArrayAdapter should find the TextView(which is used to create an Object).

-Collection : Array/Collection of the Objects which need to be shown in the ListView.

Steps to Create ListView :

- Add ListView element in the XML file or Create an Object of  ListView class .

-Create an Object of ArrayAdapter.

-Set the Adapter to the ListView.



No comments:

Post a Comment