RecyclerView Click Listener Kotlin(best and easiest way)

preview_player
Показать описание
This is a 2 part video on Kotlin RecyclerView, this is the last part.
In this tutorial we will learn the best approach to add ClickListner to the RecyclerView. This approach is simple, easy to implement and most importantly very efficient.
Unfortunately Google has not provided any builtin Click Listner for RecyclerView. Because there is no standard way of setting a click listener, new developers tend to confuse on the rightway of doing it. In this Tutorial, I will show you how to do it in a proper way.

In previous video we have learnt how to create a RecyclerView in Android using Kotlin Language.

In this video I show you the best practice way to attach an OnClickListener to a RecyclerView and determine what list item was clicked. We will learn -
- Add ClickListner to RecyclerView using Kotlin
- Access RecyclerView items outside the ViewHolder
- The right way to add clicklistner in recyclerview using kotlin
- RecyclerView OnClickListener (Best practice way) in Kotlin
- best practice way to attach an OnClickListener to a RecyclerView and determine what list item was clicked using Kotlin.
- RecyclerView - Adding Click Listener for Item

This tutorial covers -
Getting Started With RecyclerView in Android using Kotlin
RecyclerView in Kotlin: Example with Source Code
Best practice way to attach an OnClickListener to a RecyclerView and determine what list item was clicked using Kotlin.

Комментарии
Автор

Thank you very much, I watched a huge amount of material on the topic in two days, and fortunately I met your channel. in this video found the answers to all questions. Thank you, continue to please us.

cibofff
Автор

you just saved me alot bro. Thanks for this

kezileo
Автор

Thanks a lot... I solve a problem by this video..

mirazzhossain
Автор

Thank you bro. It's very helpful to my project

israfilcc
Автор

What is your approach to add item click listener on Recycler View? Do you have any better solutions, let me know by commenting below.

MunirHoque
Автор

Thank about this video..
maybe you can try to make theme to light then darcula mode for android studio.

zarncomputer
Автор

Thank you. That helped me get it working.

brianrhg
Автор

Congratulations for the video. It helped me a lot.

rubenszaes
Автор

Anyway to do this with a fragment. Passing the data from a fragment to a fragment?

CDFRAK
Автор

But what if I want all my other pages to be completely different? So if I click on item1 within my recyclerview, it takes me to a new activity/fragment where I have for example a list of courses. And when I click on item2 on the main page's recycleview, then it takes me to another page with a very different layout and stuff.
Is there an easy way to do it?

Milan-iwkr
Автор

I think that solution is good for java, in Kotlin You can pass function from activity, so there is no need to use interface.

CatatauPL
Автор

How about if I want to click on a recyclerview while using FirestoreRecyclerOptions? Which lines of codes should I change?

phuochoangminhnguyen
Автор

I'm getting this error: Type parameter bound for T in fun <T : ViewDataBinding!> setContentView(p0: Activity, p1: Int): T!
is not satisfied: inferred type ActivityArticleBinding! is not a subtype of ViewDataBinding!

jasur.tech
Автор

error: Only safe or non null assserted calls are allowed on a nullable receiver of type String?. error line:

panpanwardiman
Автор

on detailsactivity i got null error, on the image_cars.setImage.... .toInt()

dwikysetya
Автор

Vaiya contain gulo bangla korle valo hoy amder bujte subida hobe

সময়েরপথিক
Автор

"best and easy way" (20 min video duration) . -____-

rizkiadisaputra