title: Hide soft keyboard after dialog dismiss
body: <p>I want to hide soft keyboard after AlertDialog dismiss, but it's still visible. Here is my code:</p>
  
  <pre class="lang-java prettyprint-override"><code>alert = new AlertDialog.Builder(MyActivity.this);
  imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
  
  alert.setOnDismissListener(new DialogInterface.OnDismissListener() {
  
      @Override
      public void onDismiss(DialogInterface dialog) {
          imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
      }
  });
  </code></pre>