I used the following form:
Show / Hide in same role ( toggleSoftInput
):
InputMethodManager imm = (InputMethodManager) getSystemService(this.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(0, 0);
Only hide ( hideSoftInputFromWindow
):
InputMethodManager inputManager = (InputMethodManager) this.getSystemService(Context.INPUT_METHOD_SERVICE);
inputManager.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
Only display ( showSoftInput
):
InputMethodManager imm = (InputMethodManager) getSystemService(this.INPUT_METHOD_SERVICE);
imm.showSoftInput(this.cod, InputMethodManager.SHOW_IMPLICIT);