Wednesday, November 28, 2018

Listview in Android

Android ListView Tutorial

 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.

In ListView we have to declare ListView in main xml file or where you want to show the list.
And make another xml file in which we define the elements which we want to show in our list like text,images etc.

You can make list array in java file or in make String-array in String resource file.


Now we bind that data using Adapter, which pulls content from a source such as an array or database. Once we have array adapter created, then we simply call setAdapter() on our ListView object.

Android provides several subclasses of Adapter that are useful for retrieving different kinds of data and building views for an AdapterView ( i.e. ListView or GridView). The common adapters are ArrayAdapter,Base Adapter,CursorAdapter, SimpleCursorAdapter,SpinnerAdapter and WrapperListAdapter.

No comments:

Post a Comment