Android: Check if EditText is Empty when inputType is set on Number/Phone

后端 未结 9 1421
孤独总比滥情好
孤独总比滥情好 2020-12-25 15:37

I have an EditText in android for users to input their AGE. It is set an inputType=phone. I would like to know if there is a way to check if this EditText is null

9条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-25 16:14

    I use this method for same works:

    public boolean checkIsNull(EditText... editTexts){
    for (EditText editText: editTexts){
      if(editText.getText().length() == 0){
        return true;
      }
    }
    return false;
    }
    

提交回复
热议问题