Edit Text shows exception Invalid Int “”

前端 未结 5 1179
南方客
南方客 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:19

    If the input type is set to number you cannot test for "null" so the best solution is to test if length is zero, this way:

    if(number.length() == 0) {EditText is empty!!!}
    

提交回复
热议问题