Skip to content

Instantly share code, notes, and snippets.

@tfcporciuncula
Created January 6, 2019 12:46
Show Gist options
  • Save tfcporciuncula/9f1cea54dac1617799e6817bd9d34fe1 to your computer and use it in GitHub Desktop.
Save tfcporciuncula/9f1cea54dac1617799e6817bd9d34fe1 to your computer and use it in GitHub Desktop.
BooksAdapter adding click listener
override fun onBindViewHolder(holder: DataBindingViewHolder<Listable>, position: Int) {
super.onBindViewHolder(holder, position) // make sure you keep this
holder.itemView.setOnClickListener {
// whatever you want!
// you could add a Presenter/ViewModel to the Adapter constructor and call a method, for instance:
// viewModel.onItemClicked()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment