Skip to content

Instantly share code, notes, and snippets.

@hiking93
Created March 14, 2018 11:33
Show Gist options
  • Save hiking93/1c039e4e088da45dc8a3e174c5d324af to your computer and use it in GitHub Desktop.
Save hiking93/1c039e4e088da45dc8a3e174c5d324af to your computer and use it in GitHub Desktop.
Wrong implementation of context menu view holder.
class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView), View.OnLongClickListener {
val titleTextView: TextView = itemView.titleTextView
val contentTextView: TextView = itemView.contentTextView
init {
this.itemView.setOnLongClickListener(this)
}
override fun onLongClick(v: View?): Boolean {
this.itemView.showContextMenu()
return true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment