Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I may be slow to respond.

Addepalli Sri Rama Chandra Kashyap kashyapasrc

💭
I may be slow to respond.
  • India-Bharat-Jambudweep-Aryavarta
  • 22:23 (UTC +05:30)
View GitHub Profile
@arcadefire
arcadefire / RecyclerViewExtension.kt
Last active Jun 11, 2022
Add addOnItemClickListener easily to a RecyclerView using Kotlin
View RecyclerViewExtension.kt
import android.support.v7.widget.RecyclerView
import android.view.View
interface OnItemClickListener {
fun onItemClicked(position: Int, view: View)
}
fun RecyclerView.addOnItemClickListener(onClickListener: OnItemClickListener) {
this.addOnChildAttachStateChangeListener(object: RecyclerView.OnChildAttachStateChangeListener {
override fun onChildViewDetachedFromWindow(view: View?) {