Mobile App Dev Diary

Android (Java, Kotlin), iOS (Swift), Xamarin (C#)

Kotlin 1.1 / setOnClickListener

Set “setOnClickListener” to Button in Kotlin version 1.1.

val myButton: Button = findViewById(R.id.menu_camera) as Button
myButton.setOnClickListener {
    //onClick
}
Remove all ads