Set Text for text view
val textBoxVar: TextView = findViewById(R.id.textBoxID) textBoxVar.text = "Hello World!"
Button clicked – do something
val buttonVar: Button = findViewById(R.id.buttonID) buttonVar.setOnClickListener { buttonVar.text = "Button Pushed..." //Change text on button }
Toast notification
val text = "Hello World! This is a toast message!" val duration = Toast.LENGTH_SHORT val toast = Toast.makeText(applicationContext, text, duration) toast.show()