Question Detail

How to hide keyboard On button click in Android ?

6 years ago Views 1875 Visit Post Reply

I have enter values in Edittext and click on submit button but the keyboard still open. 
When I submit anything it should disappear from the screen. How can we handle it from Programming?

Thread Reply

Bili Greed

- 6 years ago

View view = this.getCurrentFocus();
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);