Try to execute
For activity:
InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); mgr.hideSoftInputFromWindow(curEditText.getWindowToken(), 0);
In the case of a fragment:
InputMethodManager mgr = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); mgr.hideSoftInputFromWindow(mEditText.getWindowToken(), 0);
Nick campion
source share