I want to make the device keyboard appear when the focus is not in the text field, etc. And the most programmatically handle keyboard events. How can I open it programmatically? And is it possible to close the keyboard programmatically?

    1 answer 1

    Use about this code:

    InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(view, flags); 

    In fact, this thing didn’t really work for me (try it), but I managed to hide it :) You can pervert and send a key press event, the focus does not help. Checked.

    • one
      I checked, it turned out that you need to open the keyboard like this: imm.toggleSoftInput (0, 0); And hide like this: imm.hideSoftInputFromWindow (view.getWindowToken (), 0); - angry