Getting a NumberFormatException from a numerical EditText field

前端 未结 7 826
长情又很酷
长情又很酷 2021-01-25 12:16

I\'m trying to create a for-loop to add views to a layout. The for-loop is working fine (I tried it with initialized variables) but I need to get an in

7条回答
  •  闹比i
    闹比i (楼主)
    2021-01-25 12:50

    You are getting this error because there is nothing or a ""/Empty String initially in your edit text. It makes no sense to get the text of an edit text when it is still being display. You may probably want to have a button or some other event which will signify that the user is done with inputting the value in the edit text and then you can go ahead and get the value of the edit text. But always have a check for the Empty String

提交回复
热议问题