Question Detail

How to hide keyboard On button click in Android ?

3 years ago Views 1062 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

- 3 years ago

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