((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE))
    .hideSoftInputFromWindow(getCurrentFocus()
    .getWindowToken(),
    InputMethodManager.HIDE_NOT_ALWAYS);