Q:

in kotlin how to set click event for recyclerview adapter

I am new on kotlin android.  I have created the adapter for recyclerview.  But I am not able to perform a click event for each recyclerview item.  I need the explanation with the reference code.  
Kindly help me to do this. 
Thanks in advance. 
Here is my code for your reference. 
  class CustomAdapter(val readerList: ReaderResponse, mainActivity: 
    MainActivity,val btnlistener: BtnClickListener) : 
    RecyclerView. Adapter<CustomAdapter. ViewHolder>() {

    companion object {
        var mClickListener: BtnClickListener?  = null
    }

    override fun onCreateViewHolder(viewgroup: ViewGroup, index: Int): ViewHolder 
    {

        val view=LayoutInflater.from(viewgroup?.context).inflate(R.layout.reader_list,viewgroup,false)
        return ViewHolder(view)
    }

    override fun getItemCount(): Int {
        return readerList.results.size

    }

    override fun onBindViewHolder(holder: ViewHolder, position: Int) {

        mClickListener = btnlistener
        val item = readerList

        val reader:ReaderData = readerList.results[position]
        /*p0?.imageview?.text=reader.readerIcon*/
        holder?.reader_status?.text=reader.readerStatus
        holder?.ward_name?.text=reader.wardName
        holder?.reader_id?.text=reader.readerID
        holder?.reader_name?.text=reader.readerName
        holder?.reader_location?.text=reader.readerLocation

        if (reader.readerStatus.toLowerCase().equals("yes")){
            holder.reader_name.setTextColor(Color.parseColor("#24a314"))
        }else if (reader.readerStatus.toLowerCase().equals("no")){

            holder.reader_name.setTextColor(Color.parseColor("#f4312d"))
            holder.warning.setVisibility(View. VISIBLE)
        }
    }

    class ViewHolder(itemView: View) :RecyclerView. ViewHolder(itemView) {

        val imageview = itemView.findViewById(R.id.imageview) as Button
        val reader_name = itemView.findViewById(R.id.reader_name) as TextView
        val reader_location = itemView.findViewById(R.id.floor_no) as TextView
        val ward_name = itemView.findViewById(R.id.ward_name) as TextView
        val reader_id = itemView.findViewById(R.id.reader_id) as TextView
        val reader_status = itemView.findViewById(R.id.reader_status) as TextView
        val warning=itemView.findViewById(R.id.warning) as Button

      }
      open interface BtnClickListener {
        fun onBtnClick(position: Int)
     }

     }

A:

You could use the following approach.  This is taken from this blog by Antonio Leiva
Assuming your data class is ReaderData
class CustomAdapter(val readers: List, val listener: (ReaderData) -> Unit) {

    /* Other methods */

    override fun onBindViewHolder(holder: ViewHolder, position: Int) {

        /*...*/

        holder.imageview.setOnClickListener { 
            listener(readers[position]) 
        }
    }
}

Now in your Activity or Fragment
recyclerview.adapter = CustomAdapter(readersList) { readerData ->
    Log.i(TAG, "${readerData.readerID} clicked")
}

The idea is you pass a lambda which will be executed when your desired item is clicked.