Android: Dynamically close the virtual keypad though code?
-
18-09-2019 - |
Question
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.
Solution
OTHER TIPS
Hi i got one more solution to hide keyboard by :
InputMethodManager imm = (InputMethodManager) getSystemService(Activity.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0);
Here pass HIDE_IMPLICIT_ONLY at the position of showFlag and 0 at the position of hiddenFlag. It will forcefully close soft Keyboard.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow