title: Recognising Escape Key
body: <p>I'm currently working on a practice program that works with various keyboard inputs so I can understand how they work in Android apps with Java. But I am struggling to get the <code>ESC</code> key to be recognised. The code below doesn't work. Has anyone ever managed to get the <code>ESC</code> key to work in an app? Is it actually possible?</p>
  
  <pre><code>editText.setOnEditorActionListener(new OnEditorActionListener() {
      @Override
      public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
          boolean handled = false;
          if (keyEvent.getKeyCode() == KeyEvent.KEYCODE_ESCAPE) {
                  textView.setText("Escapekey pressed");
              handled = true;
          } 
          return handled;
      }
  });
  </code></pre>
  
  <p>To summarize, I want the program to recognise the <code>ESC</code> key.</p>