Advertisement

TrimwebsolutionsTrimwebsolutions

Problem and Solutions

Using onClickListener in Recycler View with Retrofit Structure in Android ?

By M.K. Verma · 4 May 2022

Using onClickListener in Recycler View with Retrofit Structure in Android ?

I think the easiest way is passing function as parameter to RecyclerViewAdapter.

for instance:

RecyclerViewAdapter(val clickListener : () -> Unit)

onCreateViewHolder(){
clickListener.invoke()
}

in your view

adapter = ReceylerViewAdapter({
//do your stuff here
})