I am applying validation on my login form in android application.
If any EditText
fields is null
(empty) then I want to set Red color border for that EditText
.
If user fill any data in this Red bordered EditText
then it should turn to default EditText.
How can I implement this?
Just a tip:
Why don't you use EditText.setError("Oh, this is wrong");
Relevant documentation says:
Sets the right-hand compound drawable of the TextView to the "error" icon and sets an error message that will be displayed in a popup when the TextView has focus. The icon and error message will be reset to null when any key events cause changes to the TextView's text. If the error is null, the error message and icon will be cleared.
Another blog entry covering this topic.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With