title: OnBackPressed with a SoftKeyboard open
body: <p>I want to finish an activity when the soft keyboard is open, I want to override the back event of the soft keyboard and finish the activity.</p>
  
  <p>I'm using this but it's not working , any Idea ? </p>
  
  <pre><code> public boolean onKeyPreIme(int keyCode, KeyEvent event) {
          if (keyCode == KeyEvent.KEYCODE_BACK &amp;&amp;
                  event.getAction() == KeyEvent.ACTION_UP) {
              this.finish();
              return false;
          }
          return super.dispatchKeyEvent(event);
      }
  </code></pre>