I create my own custom keyboard.
How to adjust the search button if our keyboard is open with a parameter IME_ACTION_SEARCH?
I have the following code, but unfortunately, in the case of a search, it does not work. In a normal situation with the Finish button, it works well.
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));
}
thank
source
share