I have a EditText
and button aligned to parent's bottom.
When I enter text in it and press the button to save data, the virtual keyboard does not disappear.
Can any one guide me how to hide the keyboard?
This should work.
InputMethodManager inputManager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
inputManager.hideSoftInputFromWindow(this.getCurrentFocus().getWindowToken(),InputMethodManager.HIDE_NOT_ALWAYS);
Just make sure that this.getCurrentFocus() does not return null, which it would if nothing has focus.