Question and answer is powered by AnsPress.io
I am taking value from textbox.Now I want to convert the string to integer.
Use Integer class and the static parseInt() method.
EditText age=(EditText) findViewById(R.id.age); String x =age.getText().toString(); int age=0; try { age= Integer.parseInt(x); Log.e(TAG,"age: "+age); } catch(NumberFormatException nfe) { System.out.println("Could not parse " + nfe); }