title: how setOnKeyListener works
body: <p>we got homework to make convertor of weights where the fields are updated while typing the number (no need to click "calculate" or anything). one of the students offered the code below.
  the code works: when putting a number in field 1, field 2 changes while typing.</p>
  
  <p>what i dont understand is how does that work?
  in the <code>onKey</code> method, no value is given to <code>View</code> <code>int</code> and <code>keyEvent</code>
  so how does the listener "knows" on which view to and what keys to listen to or what event to activate ?</p>
  
  <pre><code>public class Screen extends Activity {
  double weight = 2.20462;
  EditText kgEdit, lbsEdit;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      kgEdit = (EditText) findViewById(R.id.kgEdit);
      lbsEdit = (EditText) findViewById(R.id.lbsEdit);
  
      kgEdit.setOnKeyListener(new View.OnKeyListener() {
          @Override
          public boolean onKey(View v, int keyCode, KeyEvent event) {
              String kg = kgEdit.getText().toString();
              if (kg.isEmpty()) {
                  lbsEdit.setText("");
              } else {
                  double num = Double.valueOf(kgEdit.getText().toString()) * weight;
                  lbsEdit.setText(num + "");
              }
              return false;
          }
      });
  
      lbsEdit.setOnKeyListener(new View.OnKeyListener() {
          @Override
          public boolean onKey(View v, int keyCode, KeyEvent event) {
              String lbs = lbsEdit.getText().toString();
              if (lbs.isEmpty()) {
                  kgEdit.setText("");
              } else {
                  double num = Double.valueOf(lbsEdit.getText().toString()) / weight;
                  kgEdit.setText(num + "");
              }
              return false;
          }
      });
  }
  </code></pre>
  
  <p>}</p>