class MainActivity : AppCompatActivity() { // kotlin code
var a: Int = 10
var b: Int = 5
override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main)
var btn_hello = findViewById(R.id.btn_hello) as Button
var c = a + b
var msg: String = "Kotlin"
btn_hello.setOnClickListener {
view ->
Toast.makeText(applicationContext, msg, Toast.LENGTH_SHORT).show()
}
}
}
No comments:
Post a Comment