I'am developing my own custom keyboard.
How to handle 'search' button press in case if our keyboard opened with IME_ACTION_SEARCH
parameter?
I have following code, but unfortunately in search case it's not working. In regular situation with Done button it working good.
final int options = this.getCurrentInputEditorInfo().imeOptions;
final int actionId = options & EditorInfo.IME_MASK_ACTION;
switch (actionId) {
case EditorInfo.IME_ACTION_SEARCH:
ic.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_SEARCH));
break;
default:
ic.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_ENTER));
}
Thanks
I found the solution to do it:
it's a method of
InputMethodService
The full code is: