Just the other day, I was trying to remember how to do item click in a RecyclerView. So I searched for it and expected a short-simple example that I can copy and paste. Surprisingly, none of the examples were very intuitive. I wanted something that would take less than three minutes. So, here I am again, writing this super short 3-step tutorial.
Suppose I want to display a list of the Person items.
data class Person(val name: String, val age: Int)It has a name and age. I would like to display the names in the list and show the age after they are clicked.

Step 1. I want to just pass in the list of people and the click function to my RecyclerView Adapter like this:
Step 2. In my PersonsAdapter, I want to pass down the click function to each ViewHolder.
Step 3. At last, each ViewHolder will link the click function with the view item.
That’s it. Three simple steps. Checkout GitHub to see the entire project. I hope this saves you some time.
