title: android on Text Change Listener
body: <p>I have a situation, where there are two fields. <code>field1</code> and <code>field2</code>. All I want
  to do is empty <code>field2</code> when <code>field1</code> is changed and vice versa. So at the end only
  one field has content on it.</p>
  
  <pre><code>field1 = (EditText)findViewById(R.id.field1);
  field2 = (EditText)findViewById(R.id.field2);
  
  field1.addTextChangedListener(new TextWatcher() {
  
     public void afterTextChanged(Editable s) {}
  
     public void beforeTextChanged(CharSequence s, int start,
       int count, int after) {
     }
  
     public void onTextChanged(CharSequence s, int start,
       int before, int count) {
        field2.setText("");
     }
    });
  
  field2.addTextChangedListener(new TextWatcher() {
  
     public void afterTextChanged(Editable s) {}
  
     public void beforeTextChanged(CharSequence s, int start,
       int count, int after) {
     }
  
     public void onTextChanged(CharSequence s, int start,
       int before, int count) {
       field1.setText("");
     }
    });
  </code></pre>
  
  <p>It works fine if I attach <code>addTextChangedListener</code> to <code>field1</code> only, but when
  I do it for both fields the app crashes. Obviously because they try to change
  each other indefinitely. Once <code>field1</code> changes it clears <code>field2</code> at this moment
  <code>field2</code> is changed so it will clear <code>field1</code> and so on...</p>
  
  <p>Can someone suggest any solution?</p>