title: Handle edittexts onKeyListener?
body: <p>I am creating login screen with 2 editTexts: etUsername and etPassword.  </p>
  
  <p>On the etUsername, user should input the username and press Enter to go to the edit text etPassword, then he inputs the password, press Enter to login. Here is my current code:</p>
  
  <pre><code>  etUsername.setOnKeyListener(new OnKeyListener() {   
     @Override
     public boolean onKey(View v, int keyCode, KeyEvent event) {
      if ((keyCode == KeyEvent.KEYCODE_ENTER)) {         
       etPassword.requestFocus();
       return true;
      } else
       return false;
     }
    });
  
    etPassword.setOnKeyListener(new OnKeyListener() {   
     @Override
     public boolean onKey(View v, int keyCode, KeyEvent event) {
      if ((keyCode == KeyEvent.KEYCODE_ENTER)) {         
       loginToServer();
       return true;
      } else
       return false;
     }
    });
  </code></pre>
  
  <p>But when I input the username, and then press Enter – the program tries to log in to the server.</p>
  
  <p>In the debug mode, I saw that when I pressed Enter <strong>once</strong> (on the etUsername) then first: etUsername.onKey() is called and then etPassword.onKey() is also called !  </p>
  
  <p>How can I modify the code so that the ENTER event is only processed once for the current field?</p>