I have a adapter and within this adapter class, I have Viewholder inner class. From this Viewholder I want to share the clicked item data to the bottomsheetdialogfragment.
Here is my Code for the adapter viewholder:
inner class MedicineFeelingViewHolder(v: View) : RecyclerView.ViewHolder(v), View.OnClickListener {
private var view: View = v
var medicineImage: ImageView? = null
var medicineName: TextView? = null
init {
v.setOnClickListener(this)
medicineImage = v.findViewById(R.id.medicine_image)
medicineName = v.findViewById(R.id.medicine_name)
}
override fun onClick(v: View?) {
val itemPosition = layoutPosition
Toast.makeText(v!!.context, "You have chosen "+medicineFeeling[itemPosition].medicineName, Toast.LENGTH_SHORT).show()
}
}
Is it possible to share the clicked data to my bottomsheetdialogfragment?