0% found this document useful (0 votes)
13 views1 page

Recyclerview

Android ListView is used to display a list of items in multiple rows and contains an adapter to insert items into the list. The adapter fetches data from an array or database and inserts each item into the list. There are different types of adapters including ArrayAdapter, CursorAdapter, SimpleAdapter, and BaseAdapter.

Uploaded by

wcnfw64f77
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views1 page

Recyclerview

Android ListView is used to display a list of items in multiple rows and contains an adapter to insert items into the list. The adapter fetches data from an array or database and inserts each item into the list. There are different types of adapters including ArrayAdapter, CursorAdapter, SimpleAdapter, and BaseAdapter.

Uploaded by

wcnfw64f77
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Android ListView in Kotlin

Android ListView is a ViewGroup which is used to display the list of items in


multiple rows and contains an adapter which automatically inserts the items into
the list.
The main purpose of the adapter is to fetch data from an array or database and
insert each item that placed into the list for the desired result. So, it is main
source to pull data from strings.xml file which contains all the required strings
in Kotlin or xml files.

Android Adapter
Adapter holds the data fetched from an array and iterates through each item in
data set and generates the respective views for each item of the list. So, we can
say it act as an intermediate between the data sources and adapter views such
as ListView, Gridview.
Different Types of Adapter –
 ArrayAdapter: It always accepts an Array or List as input. We can
store the list items in the strings.xml file also.
 CursorAdapter: It always accepts an instance of cursor as an input
means
 SimpleAdapter: It mainly accepts a static data defined in the
resources like array or database.
 BaseAdapter: It is a generic implementation for all three adapter
types and it can be used in the views according to our requirements.

Now, we going to create an android application named as ListViewInKotlin


using an arrayadapter. Open an activity_main.xml file from \res\layout path and
write the code like as shown below.

You might also like