Remove the error indicator from a previously-validated EditText widget
protected void onPause () {
TextView textView = ...; // fetch it as appropriate
textView.setError(null);
}
Because as mentioned in the documentation:
If the error is null, the error message and icon will be cleared.
In Kotlin:
editText.error = null
Kotlin Extension Function:
To make it more readable, you could add this extension function
fun EditText.clearError() {
error = null
}
In Java:
editText.setError(null);
You can also do it using following :
protected void onPause () {
mEditText.setError(null);//removes error
mEditText.clearFocus(); //clear focus from edittext
}