KeyEvent is triggering 2 events - can I add a delay?
<p>So I have the following code for a username and password field.  I would like to have the Enter key in Android move the cursor to the Password field.  This is working, however, my code also triggers the password field to call the signUpOrLogin function.  </p>

<p>Is there a way to add a delay or a way to get around this?</p>

<pre><code>if (usernameField.hasFocus() &amp;&amp; keyCode == KeyEvent.KEYCODE_ENTER &amp;&amp; event.getAction() == KeyEvent.ACTION_DOWN){
  passwordField.requestFocus();
  }

if (passwordField.hasFocus() &amp;&amp; keyCode == KeyEvent.KEYCODE_ENTER &amp;&amp; event.getAction() == KeyEvent.ACTION_DOWN){
  signUpOrLogin(v);
}
</code></pre>