Converting EditText to int? (Android)

前端 未结 11 1209
深忆病人
深忆病人 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

    You can use like this

     EditText dollar=(EditText) findViewById(R.id.money);
     int rupees=Integer.parseInt( dollar.getText().toString());
    

提交回复
热议问题