RecyclerView Android Studio With CardView onItemClick Position Material

RecyclerView Android Studio Example tutorial welcomes you.

This RecyclerView Android tutorial guide you to make RecyclerView with CardView and Custom Adapter.

You will learn how to get click position of RecyclerView in this RecyclerView Android Studio Example.

You will also learn to implement onClick, onItemClickListener, onItemTouchListener of RecyclerView.

We will use material design to implement RecyclerView and CardView.

First, check the output of RecyclerView Android tutorial then follow all the steps.

How to get maximum benefit from RecyclerView Android tutorial

Download Source Code for RecyclerView Android example

Try Our App

Download DemoNuts app to learn anytime, anywhere: Click to get demonuts app

Or search “demonuts” in play store from android mobile device.

Creating RecyclerView Android Studio programmatically example step by step

If you are using adblocker, then you will not be able to show our site smoothly. For example, you find step 6 after step 1 or similar to this. So please disable adblocker to fully utilize all resources of DemoNuts

Step 1: Create a new project in Android Studio.

Step 2: Updating build.gradle(Module:app) file

Add below source code into dependencies{}

Step 3. Now Click here to download images and copy them into the drawable folder.

You can learn here how to put items in drawable folder here in step 2. (No need to create xml file in drawable, just copy and paste images in drawable).

Step 4: Coding cardview.xml

Create a new file into drawable folder and name it cardview.xml

Add below source code into it.

Step 5: Making rv_item.xml

Create a new layout resource file named rv_item.xml

Copy following source code into it

Step 6: Making Model class

Create a new JAVA class named and paste below

Step 7: Code for

Let’s create Custom Adapter for RecyclerView.

Make a new JAVA class named and add below

Step 8: Finally Update activity_main.xml and

Updating activity_main.xml

Add following into activity_main.xml


Copy folowing into


Following source code will give you click position of RecyclerView

You just need to create an interface named “ClickListener”


a class named “RecyclerTouchListener”

Get great search result

Click to get Important Google searching tips

So all for RecyclerView Android tutorial. Thank you 🙂

Hardik Parsania

I am mobile app developer. I am always passionate about solving complex and real world problems.I have developed many apps with great interest and superior logical skills.

You may also like...

Leave a Reply

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