RecyclerView Button Android Studio Example Get Click Position

Welcome guys to RecyclerView Button Android Studio Example.

In this RecyclerView Button Android tutorial, you will learn to make recyclerview with button in it’s row item.

You will learn to “handle button click inside a row in recyclerview” in RecyclerView Button Android tutorial.

If you have not implement basic recyclerview with custom adapter yet, check recyclerview android example first.

Other useful tutorials,

Official guide for recyclerview : RecyclerView Official

Now checkout the output of RecyclerView Button Android example, then we will develop it.

See Birthday Application

Wish your dear ones happy birthday with special birthday cake which contains his/her name and photo on cake.

Visit app here : Name and Photo on Birthday Cake

Step 1: Create a new project in Android Studio.

When you create a new project in android studio, make default activity as an empty activity.

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

Add below source code into dependencies{}

Step 3: Coding cardview.xml

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

Add below source code into it.

Step 4: Making rv_item.xml

Create a new layout resource file named rv_item.xml

Copy following source code into it

Step 5: Making Model class

Create a new JAVA class named and paste below source code

Step 6: Adding integer.xml

Create a new file named integer.xml  in values directory and copy below

Step 7: Code for

Let’s create Custom Adapter for RecyclerView.

Make a new JAVA class named and paste below

Describing CustomAdapter

We will set tags for Plus and Minus button with below source code

Following is the onClick method for Plus button

Following is the onClick method for Minus button

Step 8: Making NextActivity

Create a new activity named “NextActivity

Add following source code into

Paste following code into activity_next.xml

Step 9: Finally Update activity_main.xml and

Updating activity_main.xml

Make following code into activity_main.xml


Copy following into

Please share this tutorial with friends.

Your sharing will help other in their path to android development.

Also you can use the comment section for any queries.

So all for RecyclerView Button Android tutorial.

Thank you.

Download Source Code for RecyclerView Button Android example

[sociallocker] Download recycler_button_code[/sociallocker]

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...

22 Responses

  1. Carel says:

    Thank you for a great tutorial. I copies and pasted the code just as it is to test it out, and the app crashes when the next activity button is clicked.

  2. dany says:

    can you share your source code

  3. Ankesh kumar says:

    please share code of above video i will be thankful

  4. Ehtisham says:

    where is the sourse code

  5. Gabs says:

    Man, can you please validate this page, is the only one that doesnt show the like button to enable the download source code button.

  6. Monu Kumar Malav says:

    recycle view one item selected than second time web service call auto item selected sovled this problam …….

  7. irshad hussain says:

    sir can i get the code plz…on my gmail or on else way

  8. Vishal Vasani says:

    how to handle recylerview inside like and dislike button in android. when is scroll the list that time like button change in dislike so how to keep state in android?

    • Hardik Parsania says:

      it is similar like we are handling getNumber and setNumber. You can use methods like getLiked and setLiked in model class.

  9. yume says:


    I have one inquiry I couldn’t implement in my project.
    I used recycelveiw connecting with firebase.
    I want to have a text to speech once the user clicks the button he/she can hear the word that connected to the image.
    could you help me with that?

  10. Cookie Respawn says:

    Thank you so much bro!
    I was stuck with a similar problem from many days,you are a life-saver!!

Leave a Reply

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