Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Edittext Validation error message in android?

In my app i usually show validation error msg like follow :

 if(someString.equals("")){
     editText.setError("UserName Should not be blank");
 } 

is there other way to show error message??

i need your suggestion

like image 812
Aristo Michael Avatar asked Jan 04 '14 12:01

Aristo Michael


1 Answers

I think the way you are showing the error message is better than toast. Sometimes toast duration is too short and the user isn't able to see that.

You can also achieve it by doing this:

EditText et11 = (EditText)findViewById(R.id.username);
if(et11.getText().toString().isEmpty())
{
    et11.setError("UserName Should not be blank");
}
like image 94
Talha Q Avatar answered Sep 17 '22 21:09

Talha Q