by clicking on button item added in recyclerview android code example
Example 1: button inside a recycle view in android in kotlin
val myButton = itemView.findViewById<Button>(R.id.myButton) // This is your Button, you declared in your xml file.
val fCard = itemView.findViewById<CardView>(R.id.cardOnFront)
val packetTime = itemView.findViewById<TextView>(R.id.timeofPacket)
val timeMessage = itemView.findViewById<TextView>(R.id.messageofTime)
val bCars = itemView.findViewById<CardView>(R.id.backCard)
val drugs = itemView.findViewById<TextView>(R.id.drugs)
val note = itemView.findViewById<TextView>(R.id.note)
val dosage = itemView.findViewById<TextView>(R.id.dosage)
Example 2: recyclerview onclicklistener kotlin
val data = list[position]holder.itemView.setOnClickListener { cellClickListener.onCellClickListener(data)}