Show Error on the tip of the Edit Text Android

前端 未结 12 2121
一生所求
一生所求 2020-12-01 04:30

I want to show error if the user enters blank value in the edittext.But i am not getting the way how could i do this .This is how i want like this:

12条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-01 04:41

    if(TextUtils.isEmpty(firstName.getText().toString()){
          firstName.setError("TEXT ERROR HERE");
    }
    

    Or you can also use TextInputLayout which has some useful method and some user friendly animation

提交回复
热议问题