useUse it.
protected void hideKeyboardDialog(Dialog dialog){ View view = dialog.getView(); if (view != null) { InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(view.getWindowToken(), 0); } }