How to send KeyEvents trough an input method service to a Dialog, or a Spinner menu?
- by shutdown11
I'm trying to implement an input method service that receives intents sent by a remote client, and in response to those sends an appropriate KeyEvent.
I'm using in the input method service this method
private void keyDownUp(int keyEventCode) {
getCurrentInputConnection().sendKeyEvent(
new KeyEvent(KeyEvent.ACTION_DOWN, keyEventCode));
getCurrentInputConnection().sendKeyEvent(
new KeyEvent(KeyEvent.ACTION_UP, keyEventCode));
}
to send KeyEvents as in the Simple Sofykeyboard Sample, and it works in the home, in Activities... but it doesn't works when a Dialog or the menu of a Spinner is in foreground.
The events is sent to the parent activity behind the Dialog.
Is there any way to send keys and control the device like using the hardware keys from an input method?