0

I have created a custom keyboard which is working fine so far , but i am getting an issue , when i try to send message in Instagram app (or any other app) , action enter didn't work.

My code :

private void sendKey(int keyCode) {
    switch (keyCode) {
        case '\n':
            keyDownUp(KeyEvent.KEYCODE_ENTER);
            break;
        default:
            if (keyCode >= '0' && keyCode <= '9') {
                keyDownUp(keyCode - '0' + KeyEvent.KEYCODE_0);
            } else {
      this.mInputConnection.commitText(String.valueOf((char) keyCode), 1);
                removeSuggestionFromTextView();
            }
            break;
    }
}

Thanks in advance.

Nibha Jain
  • 7,742
  • 11
  • 47
  • 71
  • 1
    Please specify what `not working` means in terms of errors, unexpected result etc. – Alex B. Aug 08 '16 at 09:38
  • have u debugged it? does it goes into the '\n' case? maybe its not the right case to use for the enter key..try with case 13: https://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes – Antonios Tsimourtos Aug 08 '16 at 10:13
  • getCurrentInputEditorInfo() from this method I always get actionId = 0 instead of 4 in case of imeOption send. – Ravi Thakur Aug 09 '16 at 11:06

0 Answers0