Show Error on the tip of the Edit Text Android

前端 未结 12 2109
一生所求
一生所求 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:43

    I know it's too late, but in case someone still need help. Here is the working solution. Setting an error is pretty straight forward. But it will be displayed to user, when he request Focus on it. So to do the both thing on your own, User this code.

     firstName.setError("Enter FirstName");
     firstName.requestFocus();
    

提交回复
热议问题