Search code examples
androidkotlinapkkotlin-generics

(kotlin) editText.toString().toInt() isn't work in anroid studio


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.


Solution

  • Get the String out of EditText: editText1.getText().toString().toInt()