Converting EditText to int? (Android)

前端 未结 11 1155
深忆病人
深忆病人 2020-12-09 03:08

I am wondering how to convert an edittext input to an int, I have the user input a number, it than divides it by 8.

MainActivity.java

@SuppressWarnin         


        
11条回答
  •  醉梦人生
    2020-12-09 03:54

    Try the line below to convert editText to integer.

    int intVal = Integer.parseInt(mEtValue.getText().toString());
    

提交回复
热议问题