Question Detail

How to hide keyboard On button click in Android ?

4 years ago Views 1464 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

- 4 years ago

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