EditText setError message does not clear after input

API documentation: "The icon and error message will be reset to null when any key events cause changes to the TextView's text." Though it is not so - and therefore we can regard this as bug.

If you use inputType such as textNoSuggestions, textEmailAddress, textPassword, the error is unset after a character is typed. Nearly as documented but again not exactly - when you delete a character, error stays. It seems, a simple workaround with addTextChangedListener and setError(null) can attain promised behavior.

Besides there are posts about icon losing on Android 4.2. So use with care.


In your else bracket, put playerName.setError(null), which will clear the error.

Tags:

Android