Skip to content Skip to sidebar Skip to footer

Convert Edittext Input To Integer And Multiply?

I tried using Integer.parseInt(), but it doesn't convert it EditText's String input to integer. I need to use integers to multiply data and calculate total. EditText is not empty.

Solution 1:

Instead of this,

a = Integer.parseInt(textIn1.getText().toString());

try it,

a = Integer.valueOf(textIn1.getText().toString());

Also add

android:inputType="number"

in your xml layout file.

<EditText...android:inputType="number"/>

to input only numbers.

Post a Comment for "Convert Edittext Input To Integer And Multiply?"