title: Android - Why does onKeyUp trigger a KeyEvent, but onKeyDown does not?
body: <p>In my current View, a keyboard is open with numbers 0 to 9, a delete key and an enter key.
  I added both an <code>onKeyDown</code> and an <code>onKeyUp</code> event. Both should log the keycode to the debug console when pressed.</p>
  
  <pre><code>@Override
  public boolean onKeyDown(int pKeyCode, KeyEvent pKeyEvent) {
      Log.d("KEYDOWN", pKeyCode+"");
      return true; // also tried false
  }
  @Override
  public boolean onKeyUp(int pKeyCode, KeyEvent pKeyEvent) {
      Log.d("KEYUP", pKeyCode+"");
      return true;
  }
  </code></pre>
  
  <p>I pressed every single key on the keyboard with the following result:</p>
  
  <pre><code>D/KEYUP: 8
  D/KEYUP: 9
  D/KEYUP: 10
  D/KEYUP: 11
  D/KEYUP: 12
  D/KEYUP: 13
  D/KEYUP: 14
  D/KEYUP: 15
  D/KEYUP: 16
  D/KEYDOWN: 67
  D/KEYUP: 67
  D/KEYUP: 7
  D/KEYUP: 66
  </code></pre>
  
  <p>Can someone explain why the keydown event is never triggered for 0-9 and enter? I really need it to trigger when 0-9 are pressed.</p>
  
  <blockquote>
    <p><strong>EDIT:</strong> I added a solution that fixed the issue by replacing both functions with <code>dispatchKeyEvent</code>. This doesn't explain why
    <code>onKeyDown</code>didn't recognize those keys, though.</p>
    
    <p>Someone got an answer for this?</p>
  </blockquote>