Check if an Edit Text that only accepts number is not empty and the number is equal or less than 100

前端 未结 5 1335
清歌不尽
清歌不尽 2020-12-20 07:57

I\'m building an application for receiving grades and I want to make sure that the Edit Texts are not empty and the values are less or equal to 100 I wrote this line but it

5条回答
  •  清酒与你
    2020-12-20 08:58

    First You Put In Your XML EditText Input Type=Number

    Then Write This Code

    If(edittext.getString().toString().Trim().lenght()>0)
    {
         If(Integer.parseInt(editText.gettext().toString()) <= 100 )
         {
    
         }
    }
    

提交回复
热议问题