views:

863

answers:

1

How can you dynamically close the virtual keypad through code? All I want to do is close it when the user clicks an "Ok" button because it is not closing itself even though the button now has focus.

+1  A: 

http://stackoverflow.com/questions/1109022/how-to-close-hide-the-android-soft-keyboard

CommonsWare
That doesn't answer the question
Tawani
Yes, it does. "You can force Android to hide the virtual keyboard using the InputMethodManager, calling hideSoftInputFromWindow, passing in the token of the window containing your edit field." That answers your question "How can you dynamically close the virtual keypad through code?".
CommonsWare
"hide" != "close"I will still need the keypad to open when I click again in another text field
Tawani
I had to attach this to a button so that the keypad can keep reappearing the next time I entered a text box
Tawani