I used it as follows:
Show/Hide in the same function (toggleSoftInput
):
InputMethodManager imm = (InputMethodManager) getSystemService(this.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(0, 0);
Only hide (hideSoftInputFromWindow
):
InputMethodManager inputManager = (InputMethodManager) this.getSystemService(Context.INPUT_METHOD_SERVICE);
inputManager.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
Only display (showSoftInput
):
InputMethodManager imm = (InputMethodManager) getSystemService(this.INPUT_METHOD_SERVICE);
imm.showSoftInput(this.cod, InputMethodManager.SHOW_IMPLICIT);
Didn’t work Anderson. But I got it here already. Thanks !
– rbz
Anderson, tested again. Do not open the keyboard is working perfectly. What does not work is show the keyboard. If you can check, thank you.
– rbz
I will edit the answer, I just tested android 8.1.0 and took. Take the test the new way and tell me
– AndersonCanteiro
Now you changed to method "toggle"... was practically the same as mine ! rs Actually I tested yours, it worked, but gave a problem because the
etNumerico.setInputType(InputType.TYPE_NULL);
he broke my field parameter to be "number". I will post in my detailed reply as it was– rbz
Yeah, the only difference is it’s past the show and hide flags. The method I passed before, I use an application for an android tablet 2.3, so it may be the reason not to pick the newest android. I believe the toggle is better.
– AndersonCanteiro
In my case yes, I need the toggle because I’m using a floating button. But thanks for the hand ! ;]
– rbz