Edit Text shows exception Invalid Int “”

前端 未结 5 1184
南方客
南方客 2020-12-07 04:50

I have already tried setting the EditText default value to be zero but when it comes to editing and erase as \"\" ( empty space , no more wordings _ in the Edit Text field <

5条回答
  •  天命终不由人
    2020-12-07 05:36

    In the aboue code you have used like converting String to Integer in that case you will not convert ""(Empty String) to Integer

    Integer.parseInt(monthlyTest);  // Here monthyTest value is ""
    

    Please make sure the string is not empty befor conversion.

    Check the length of the String is should be greater than 0.

    if(monthlyTest.length()>0)
    

    Thanks.....

提交回复
热议问题