title: Android EditText setError() doesn't work as expected
body: <p>I am having a problem with <code>setError()</code> on <code>EditText</code>. When an activity is opened, it checks if certain fields are empty and sets error message on them if true. However, the exclamation mark icon is only displayed in case I write some text in field and then delete it. If I lose focus on that field, the icon will disappear again. Both fields <code>Naam</code> and <code>Telefonnumer</code> have this validation.</p>
  
  <p><strong>I use Android 2.2.2 SDK and the application is run on Nexus 7 with latest updates.</strong></p>
  
  <p>I have Util class:</p>
  
  <pre><code>public class Util {
  
      private static String TAG = "Util Class";
  
      public static boolean editTextIsEmpty(EditText edittext) {
          if (edittext.getText().toString().trim().length() &lt; 1)
              return true;
          else
              return false;
      }
  
      public void editTextListener(final EditText editText) {
          editText.addTextChangedListener(new TextWatcher() {
  
              @Override
              public void afterTextChanged(Editable s) {
                  // TODO Auto-generated method stub
              }
  
              @Override
              public void beforeTextChanged(CharSequence s, int start, int count, int after) {
                  if (editTextIsEmpty(editText) &amp;&amp; editText.isEnabled())
                      editText.setError("Nodig");
                  else
                      editText.setError(null);
              }
  
              @Override
              public void onTextChanged(CharSequence s, int start, int before, int count) {
                  if (editTextIsEmpty(editText) &amp;&amp; editText.isEnabled())
                      editText.setError("Nodig");
                  else
                      editText.setError(null);
              }
          });
      }
  }
  </code></pre>
  
  <p>and then I have method <code>validateInput()</code> in my activity:</p>
  
  <pre><code>public class DeliveryActivity extends BaseActivity {
  
      private ImageButton btnSetDate;
  
      private Button btnToSummary;
      private Button btnSearchAddress;
  
      private EditText txtPostcode;
      private EditText txtHouseNumber;
      private EditText txtHouseNumberSuffix;
      private EditText txtStreet;
      private EditText txtCity;
      private EditText txtDeliveryDate;
      private EditText txtName;
      private EditText txtPhone;
      private EditText txtEmail;
      private EditText txtRemark;
  
      private TextView lblExtraDeliveryInfo;
  
      private Spinner spinnerDelivery;
      private Spinner spinnerDeliveryPeriod;
      private Spinner spinnerContact;
      private Spinner spinnerDeliveryAddress;
      private Spinner spinnerExtraDeliveryInfo;
  
      private RelativeLayout rlDeliveryAddressDetails;
  
      private DevRestHelper additionalDeliveryInfo;
      private DevRestHelper searchClientAddress;
  
      private Util util = new Util();
  
      private int year;
      private int month;
      private int day;
  
      public static final int DIALOG_DATEPICKER = 0;
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_delivery);
  
          initControls();
  
          validateInput();
      }
  
      private void initControls() {
          btnSetDate = (ImageButton) findViewById(R.id.activity_delivery_btnCalendar);
  
          btnToSummary = (Button) findViewById(R.id.activity_delivery_btnSummary);
          btnSearchAddress = (Button) findViewById(R.id.activity_delivery_btnSearchAddress);
  
          spinnerDelivery = (Spinner) findViewById(R.id.activity_delivery_spinnerDeliveryMethod);
          spinnerDeliveryPeriod = (Spinner) findViewById(R.id.activity_delivery_spinnerDeliveryPeriod);
          spinnerContact = (Spinner) findViewById(R.id.activity_delivery_spinnerContactperson);
          spinnerDeliveryAddress = (Spinner) findViewById(R.id.activity_delivery_spinnerDeliveryAddress);
          spinnerExtraDeliveryInfo = (Spinner) findViewById(R.id.activity_delivery_spinnerExtraDeliveryInformation);
  
          txtPostcode = (EditText) findViewById(R.id.activity_delivery_txtPostcode);
          txtHouseNumber = (EditText) findViewById(R.id.activity_delivery_txtHousenumber);
          txtHouseNumberSuffix = (EditText) findViewById(R.id.activity_delivery_txtHousenumberSuffix);
          txtStreet = (EditText) findViewById(R.id.activity_delivery_txtStreet);
          txtCity = (EditText) findViewById(R.id.activity_delivery_txtCity);
          txtDeliveryDate = (EditText) findViewById(R.id.activity_delivery_txtDeliveryDate);
          txtName = (EditText) findViewById(R.id.activity_delivery_txtName);
          txtPhone = (EditText) findViewById(R.id.activity_delivery_txtPhone);
          txtEmail = (EditText) findViewById(R.id.activity_delivery_txtEmail);
          txtRemark = (EditText) findViewById(R.id.activity_delivery_txtRemark);
  
          lblExtraDeliveryInfo = (TextView) findViewById(R.id.activity_delivery_lblExtraDetailInformation);
  
          rlDeliveryAddressDetails = (RelativeLayout) findViewById(R.id.activity_delivery_rlDeliveryAddressDetails);
      }
  
      private void validateInput() {
          util.editTextListener(txtPostcode);
          util.editTextListener(txtHouseNumber);
          util.editTextListener(txtDeliveryDate);
      }
  }
  </code></pre>
  
  <p>Let me just say that code work on BlueStacks emulator.</p>
  
  <p><img src="https://i.stack.imgur.com/Jk3Yc.png" alt="enter image description here"></p>