title: multiple editText, textchangedlistener only work if all editText are filled
body: <p>I try to do a small interface in which i put a number and the result of a calculation is shown in a text field. I god several operation in the same interface. So i tried a regular addtextchangedlistener , it works but i noticed that i need to fill every editText on which I added a the listener for it to work.</p>
  
  <p>Here is my first code:</p>
  
  <p><CODE></p>
  
  <pre><code>package be.thebeps.easyconverter;
  
  import android.os.Bundle;
  import android.app.Activity;
  import android.view.Menu;
  import android.widget.*;
  import android.text.*;
  
  public class MainActivity extends Activity implements TextWatcher  {
  
      private Double calcula;
      private EditText calcula1;
      private TextView calcula2;
      private Double calculb;
      private EditText calculb1;
      private TextView calculb2;
  
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          calcula1 = (EditText) findViewById(R.id.calcula1);
          calcula1.addTextChangedListener(this);
          calcula2 = (TextView) findViewById(R.id.calcula2);
          calculb1 = (EditText) findViewById(R.id.calculb1);
          calculb1.addTextChangedListener(this));
          calculb2 = (TextView) findViewById(R.id.calculb2);
  
  
  
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.activity_main, menu);
          return true;
      }
  
  
  
  
  
      @Override
      public void afterTextChanged(Editable s) {
  
          try {
  
              calcula = Double.parseDouble(calcula1.getText().toString());
              calcula = calcula*0.621;
              calcula2.setText(String.format("%.3f", calcula));
              calculb = Double.parseDouble(calculb1.getText().toString());
              calculb = calculb*2.204;
              calculb2.setText(String.format("%.2f", calculb));
  
  
  
          } catch(NumberFormatException nfe) {
              calcula2.setText(Integer.toString(0));
              calculb2.setText(Integer.toString(0));
  
  
          }
      }   
  
  
      @Override
      public void beforeTextChanged(CharSequence s, int start, int count, int after) {
  
  
      }
  
      @Override
      public void onTextChanged(CharSequence s, int start, int count, int after) {
  
  
      }   
  
  }
  </code></pre>
  
  <p></CODE></p>
  
  <p>Then as it wasn't working as expected, i tried to implement a class for instanciate the textWatcher on each editText fields, so here is my actual code :</p>
  
  <p><CODE></p>
  
  <pre><code>import android.os.Bundle;
  import android.app.Activity;
  import android.view.Menu;
  import android.widget.*;
  import android.text.*;
  
  public class MainActivity extends Activity {
  
      private Double calcula;
      private EditText calcula1;
      private TextView calcula2;
      private Double calculb;
      private EditText calculb1;
      private TextView calculb2;
  
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          calcula1 = (EditText) findViewById(R.id.calcula1);
          calcula1.addTextChangedListener(new CustomTextWatcher(calcula1));
          calcula2 = (TextView) findViewById(R.id.calcula2);
          calculb1 = (EditText) findViewById(R.id.calculb1);
          calculb1.addTextChangedListener(new CustomTextWatcher(calculb1));
          calculb2 = (TextView) findViewById(R.id.calculb2);
  
  
  
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.activity_main, menu);
          return true;
      }
  
  
  
  
      private class CustomTextWatcher implements TextWatcher {
          private EditText mEditText;
  
          public CustomTextWatcher(EditText e) { 
              mEditText = e;
          }
  
          @Override
          public void afterTextChanged(Editable s) {
  
              try {
  
                  calcula = Double.parseDouble(calcula1.getText().toString());
                  calcula = calcula*1.451;
                  calcula2.setText(String.format("%.3f", calcula));
                  calculb = Double.parseDouble(calculb1.getText().toString());
                  calculb = calculb*3.206;
                  calculb2.setText(String.format("%.2f", calculb));
  
  
  
              } catch(NumberFormatException nfe) {
                  calcula2.setText(Integer.toString(0));
                  calculb2.setText(Integer.toString(0));
  
              }
          }   
  
  
      @Override
      public void beforeTextChanged(CharSequence s, int start, int count, int after) {
  
  
      }
  
      @Override
      public void onTextChanged(CharSequence s, int start, int count, int after) {
  
  
      }   
  
      }
  }
  </code></pre>
  
  <p></CODE></p>
  
  <p>But still, if only one of the 2 field is filled up, i it's not updated when i change it (i mean aftertextchanged method is not called). I was thinking to already fill the editText when creating the view but still, if someone go in one editText (calcula1 for eg) and clear it out (with backspace for eg) and then go in calculb1, he can input every number he want, calculb2 will not be modified. I know it's tricky and I am kind of picky, but I'll be glad if someone can help me with that.</p>