Validate EditText as text is typed to remove setError
<p>I am trying to validate text entry in EditText fields. I have <code>setErrors</code> created when no text in entered in a field. The fields are validated when the <code>Submit</code> button is pressed. </p>

<p>If a <code>setError</code> is thrown for an empty field, then text is typed in the field, the <code>setError</code>will disappear when <code>Submi</code>t is pressed or when the enter key is pressed in the field - NOT when the user types text in the empty field, then manually taps to another field. The <code>setErro</code>r for the first field is still active, even though text has been entered. </p>

<p>I'm thinking <code>EditText</code> could be validated as text is typed to fix this issue.<br>
 Is this the correct way to do this?</p>

<pre><code>EditText toText = (EditText) findViewById(R.id.to);
EditText subjectText = (EditText) findViewById(R.id.subject);

if (toText.getText().length() == 0) {
    toText.setError("Please enter a valid recipient");
}

else {
    toText.setError(null);
}

if (subjectText.getText().length() == 0) {
    subjectText.setError("Please enter a subject");
}

else {
    subjectText.setError(null);
}
</code></pre>

<p>So what I'm trying to achieve: </p>

<ul>
<li>User forgets to enter text in toText</li>
<li>User clicks Submit and the setError message appears</li>
<li>User types text in toText</li>
<li>User taps subjectText</li>
<li>toText still displays the setError</li>
<li>I would like to remove setError in this scenario</li>
</ul>

<p>toText will remove the setError if:</p>

<ul>
<li>User clicks Submit again to revalidate the fields</li>
<li>User hits enter on the keyboard to advance to the next field</li>
</ul>
