how to use onclick in kotlin code example
Example 1: on click in kotlin
button.setOnClickListener(object : View.OnClickListener {
override fun onClick(v: View?) {
//your implementation goes here
}
})
Example 2: kotlin onclicklistener
text_view.setOnClickListener {
val intent = Intent(this@MainActivity, SecondActivity::class.java)
intent.putExtra("key", "Kotlin")
startActivity(intent)
}