Code example for InputMethodManager

Methods: hideSoftInputFromWindow, isActive

0
    public void onDismiss(DialogInterface dialog) {
        if (mInputMethodManager == null) {
            mInputMethodManager = (InputMethodManager) getContext().getSystemService(
                    Context.INPUT_METHOD_SERVICE);
        } 
        if (mDialog != null && mInputMethodManager.isActive()) {
            mInputMethodManager.hideSoftInputFromWindow(mDialog.getWindow().getDecorView()
                    .getApplicationWindowToken(), InputMethodManager.HIDE_IMPLICIT_ONLY);
        } 
        getPreferenceManager().unregisterOnActivityDestroyListener(this);
        mDialog = null;
        onDialogClosed(mWhichButtonClicked == DialogInterface.BUTTON_POSITIVE);
    } 
 
    protected void onPrepareDialogBuilder(AlertDialog.Builder builder) {
    } 
 
    @Override 
    protected void onRestoreInstanceState(Parcelable state) {
        if (state == null || !state.getClass().equals(SavedState.class)) {
            super.onRestoreInstanceState(state);