val editText1 = findViewById<EditText>(R.id.editText1);
if(comNum != editText1.toString().toInt() ){
View4.text = "오답"
} else View4.text = "정답"
The installed apk is not working. I think edittext.toString.toInt is wrong.
val editText1 = findViewById<EditText>(R.id.editText1);
if(comNum != editText1.toString().toInt() ){
View4.text = "오답"
} else View4.text = "정답"
The installed apk is not working. I think edittext.toString.toInt is wrong.
On
Wrong
editText1.toString().toInt()
It should be
editText1.text.toString().toInt()
FYI
toInt() Parses the string as an Int number and returns the result. if the string is not a valid representation of a number you will receive NumberFormatException .
On
Try this
val editText1 = findViewById<EditText>(R.id.editText1);
if(comNum != Integer.parseInt(editText1.text.toString()) ){
View4.text = "오답"
} else View4.text = "정답"
Get the
Stringout ofEditText:editText1.getText().toString().toInt()