title: Dismiss current dialog when other dialog shows by other application
body: <p>I have a trouble with implement IME on android.</p>
  
  <p>When user presses a key, the dialog will be shown.
  Then, user drags down notification bar and choose "Select input method", a new dialog appears. But my dialog covers the "Select input method" (called by android).</p>
  
  <p>I want to dimiss my dialog before "Select input method" is shown. How do I do that ?</p>
  
  <pre><code>    // This is my source to show Dialog:
      AlertDialog.Builder builder = new AlertDialog.Builder(mIme.getApplicationContext());
      builder.setCancelable(true);
      builder.setOnKeyListener(new DialogInterface.OnKeyListener() {
          public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
              if (event.getAction() == KeyEvent.ACTION_UP) {
                  dialog.dismiss();
              }
              return false;
          }
      });
      builder.setAdapter(mModeAdapter, new DialogInterface.OnClickListener() {
  
          public void onClick(DialogInterface di, int position) {
              di.dismiss();
              }
          }
      });
      builder.setTitle(mIme.getResources().getString(R.string.input_method));
      mOptionsDialog = builder.create();
      mOptionsDialog.show();
  </code></pre>