Empty Edit Text Gives Me Error For 0 Value
I'm developing a project and I have problem with my addition for empty EditText( unused) . If I enter a number in my editText then click the button it will show the output in the v
Solution 1:
If you enter nothing you get a blank in
text2.getText().toString()
and you get a NumberFormatException.
You should set `valueText2 to 0 if no text is entered:
int valueText2 = 0;
if (text2.getText() != null && !text2.getText().toString().equals("")){
int valueText2 = Integer.parseInt(text2.getText().toString());
Post a Comment for "Empty Edit Text Gives Me Error For 0 Value"