Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/kotlin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android (kotlin)editText.toString().toInt()不是';我不在安罗伊工作室工作 val editText1=findViewById(R.id.editText1); if(comNum!=editText1.toString().toInt()){ View4.text=”오답" }else View4.text=”정답"_Android_Kotlin_Apk_Kotlin Generics - Fatal编程技术网

Android (kotlin)editText.toString().toInt()不是';我不在安罗伊工作室工作 val editText1=findViewById(R.id.editText1); if(comNum!=editText1.toString().toInt()){ View4.text=”오답" }else View4.text=”정답"

Android (kotlin)editText.toString().toInt()不是';我不在安罗伊工作室工作 val editText1=findViewById(R.id.editText1); if(comNum!=editText1.toString().toInt()){ View4.text=”오답" }else View4.text=”정답",android,kotlin,apk,kotlin-generics,Android,Kotlin,Apk,Kotlin Generics,安装的apk不工作。我认为edittext.toString.toInt是错误的。从edittext中获取字符串:editText1.getText().toString().toInt()从edittext中获取字符串:editText1.getText().toString().toInt()错误 val editText1 = findViewById<EditText>(R.id.editText1); if(comNum != editText1.toString().t

安装的
apk
不工作。我认为
edittext.toString.toInt
是错误的。

edittext
中获取
字符串
editText1.getText().toString().toInt()
edittext
中获取
字符串
editText1.getText().toString().toInt()

错误

val editText1 = findViewById<EditText>(R.id.editText1);

if(comNum != editText1.toString().toInt() ){

 View4.text = "오답"
            } else View4.text = "정답"
应该是

 editText1.toString().toInt()
FYI

将字符串解析为整数并返回结果。如果字符串不是有效的数字表示形式,则您将收到。

错误

val editText1 = findViewById<EditText>(R.id.editText1);

if(comNum != editText1.toString().toInt() ){

 View4.text = "오답"
            } else View4.text = "정답"
应该是

 editText1.toString().toInt()
FYI

将字符串解析为整数并返回结果。如果字符串不是您将收到的数字的有效表示形式。

请尝试此操作

editText1.text.toString().toInt()
val editText1=findViewById(R.id.editText1);
if(comNum!=Integer.parseInt(editText1.text.toString()){
View4.text=”오답"
}else View4.text=”정답"
试试这个

editText1.text.toString().toInt()
val editText1=findViewById(R.id.editText1);
if(comNum!=Integer.parseInt(editText1.text.toString()){
View4.text=”오답"
}else View4.text=”정답"

尝试下面的代码,您不能使用
editText1.toString().toInt()


希望这有帮助

尝试下面的代码,您不能使用
editText1.toString().toInt()

希望这有助于使用

  var value: Int

  try {
         value =  editText1.text.toString().toInt();
  } catch (e: NumberFormatException) {
         // value of editText1 is a invalid Integer
  }
  if(comNum != value ){
  View4.text = "오답"
  } else View4.text = "정답"
使用


你能从logcat发布堆栈跟踪吗?你能从logcat发布堆栈跟踪吗?非常感谢!!!我处理了将近3个小时ㅠㅠ. 非常非常感谢谢谢!!!我处理了将近3个小时ㅠㅠ. 非常非常感谢