private inner class CrimeHolder(view: View)
: RecyclerView.ViewHolder(view), View.OnClickListener {
private lateinit var crime: Crime
private val titleTextView: TextView = itemView.findViewById(R.id.crime_title)
private val dateTextView: TextView = itemView.findViewById(R.id.crime_date)
init {
itemView.setOnClickListener(this)
}
fun bind(crime: Crime) {
this.crime = crime
titleTextView.text = this.crime.title
dateTextView.text = this.crime.date.toString()
}
override fun onClick(v: View) {
Toast.makeText(context, "${crime.title} pressed!", Toast.LENGTH_SHORT)
.show()
}
}
The error is :
-
Class ‘CrimeHolder’ is not abstract and does not implement abstract member public abstract fun onClick(v: View!): Unit defined in android.view.View.OnClickListener
-
‘onCLick’ overrides nothing