I switched from Java to Kotlin and I am completely new.
I tried to make an app that calculates your age to minute.
The age
input is through EditText
in Android Studio.
Then to set your age into TextView
.
When I press on the button that application crashes. Below is the Kotlin Code
var edtTxtAge = findViewById<EditText>(R.id.edtTxtAge)
val btnCalc = findViewById<Button>(R.id.btnCalc)
var txtAge = findViewById<TextView>(R.id.txtAge)
btnCalc.setOnClickListener(View.OnClickListener {
val minutesPerYear = 525600
val age = edtTxtAge.toString().toInt() * minutesPerYear
txtAge.text = "Your age in minutes is: " + age.toString()
})