Reputation: 3796
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();
Upvotes: 9
Views: 9623
Reputation: 11
Example
=======
xml
---
<EditText
android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
java
-----
private EditText EditText1;
username = (EditText) findViewById(R.id.name);
username .setError(null);
Upvotes: 0
Reputation: 72331
You should do the following :
mEditText.setError(null);//removes error
mEditText.clearFocus();
Upvotes: 24