When I set error and request focus on edittext then it sets an error and request focus but how can I remove error and remove focus ?
mEditTextSearchOrAdd.setError("Error");
mEditTextSearchOrAdd.requestFocus();
Remove focus but remain focusable: editText. setFocusableInTouchMode(false); editText. setFocusable(false); editText.
You can use View. OnFocusChangeListener to detect if any view (edittext) gained or lost focus. This goes in your activity or fragment or wherever you have the EditTexts.
Now you can simply do input. setError(..) for new error and input. setErrorEnabled(false) to remove it.
You should do the following :
mEditText.setError(null);//removes error
mEditText.clearFocus();
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