How can I detect key presses reliably with a hard or soft keyboard?
My app remotely controls another device over wifi, and I need to detect every key press on either a soft or hard keyboard. I don't really need an EditText because I just need to send the characters one at a time as they are pressed and don't need the final text string.
I have tried using an EditText with OnKeyPress, but ran into the problems here with not getting key presses with soft keyboards. And TextWatcher isn't a good option because I need each key press.
I'll use an EditText if I have to, but would prefer not to. What I really want is to:
- Bring up a soft keyboard when the user hits a Search button
- User presses keys and I transmit the codes to remote device. Don't really need to see anything on screen in an EditText since it will be shown on the remote device
- User presses the custom Done button on the soft keyboard to close it
Any suggestions?