In mobile applications a lot of data needs to be shown in form of a listview which will consume more data and can cause problem in populating view in some cases so for this cause Android RecyclerView is introduced.

Generally from the word itself we can understand that recycle means reusing of the same view many times, listview does  the same but in additional here every time data is recycled and loaded so that additional data is not required in this typr of scenario.

Using RecyclerView is much advised as it will use the resources accordingly as needed and will work smoothly.so this can be a small intro regarding what we are going to do in this tutorial and what’s the purpose of it.

Before going any further we require few files to be added to gradle dependencies to go with recyclerview they are

 

 

Here i am using a RecyclerView to generate a listview this

this recycle view will help in recreating view every time so instead of regular listview we use this recyclerview.

 

Creating activity_main.xml :

 

Including the above recycler view in xml file

 

Then according to the above recyclerview we will design a listview type row as

 

Creating list_item.xml :

 

Creating a list_item in this style as below where we are adding two textviews and imageview. recyclelist

 

 

 

 

 

So the designing of the listview using recyclerview is completed then we will focus on data to be passed and processed in the listview  

 

Creating MainActivity.java :

 

Here we are adding three ArrayList to assign data to listview as

and then images as

Then we will be initializing recyclerview which we have declared in activity_main.xml

Then setting up it with adapter

 

MainActivity Full Code

 

Then creating ListAdapter which will be using recycleview to process a listview

Creating ListAdapter :

 

So here we are done with this tutorial and if you have any queries can ask below.

Output :

recycle1

 

recycle2

Show Buttons
Hide Buttons
Read previous post:
Android Tutorial On Gallery View

Close