on click in kotlin
snippet in kotlin

setOnClickListener example kotlin

user2785

// set on-click listener
btn_click_me.setOnClickListener {
    Toast.makeText(this, "You clicked me.", Toast.LENGTH_SHORT).show()
}

on click in kotlin

user4186

button.setOnClickListener(object : View.OnClickListener {
            override fun onClick(v: View?) {
                //your implementation goes here
            }
        })