My goal is to show/hide on-screen software keyboard on some event and intercept input from that keyboard.
I found out that soft keyboard can be shown for some View
class descendants, but I don't need any visual representation of the text edit widget on screen, just the ability to programmatically show/hide soft keyboard with input interception.
What is the best way to achieve this?
You can force the Softkeyboard to be shown by using:
and to hide:
Even if this question was asked almost a year ago it didn't have an accepted and fully helpful answer and since I ran into the same problem myself I though I'd share my solution:
As Vikram pointed out this is the way to show the soft input:
BUT you must also set your view as focusable and focusable in touch mode:
or in your view XML:
Actually, you can
always
show a soft keyboard input from manifest. add this line to each activity you want to show soft keyboard:Soft keyboard will show up no matter if there's no edittext in the view. example: