Hide soft keyboard after dialog dismiss
===

I want to hide soft keyboard after AlertDialog dismiss, but it's still visible. Here is my code:

<!-- language: java -->

    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);
        }
    });