1

IMPORTANT

I am developing an app in which I have integrated virtual keyboard for emojies using InputMethodService. Now, I can switch from my Virtual keyboard to default softkeyboard as below :

emojiKeyboard.switchToPreviousInputMethod();

where emojiKeyboard is the object of EmojiKeyboardService class which extends InputMethodService

The method switchToPreviousInputMethod() is as below :

public void switchToPreviousInputMethod() {
    Vibrator vib = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
    vib.vibrate(25);
    try {
        previousInputMethodManager.switchToLastInputMethod(iBinder);
    } catch (Throwable t) { // java.lang.NoSuchMethodError if API_level<11
        Context context = getApplicationContext();
        CharSequence text = "Unfortunately input method switching isn't supported in your version of Android! You will have to do it manually :(";
        int duration = Toast.LENGTH_SHORT;
        Toast toast = Toast.makeText(context, text, duration);
        toast.show();
    }
}

So, switching to my Virtual keyboard is headache. Is there any way to do it programmatically ? Because I can set it from device settings again.

But, We know that it should not that User has to go to settings each time when he switched to default soft keyboard.

Please guide. Hope for the positive answer.

thanks.

ZaptechDev Kumar
  • 164
  • 1
  • 14
  • I am not clear what you want. you want an easy way to switch to the previous keyboard from your emoji-keyboard? (you already doing it in the above code...) or do you want an easy way to get to "your-emoji-keyboard" from the "someone-else's-keyboard"? – flide Jan 28 '17 at 08:45
  • I can easily switch from Custom keyboard launched to default, But, can not from default to my custom.. without again go to settings and set it. – ZaptechDev Kumar Jan 30 '17 at 06:34
  • there is no way to you can make someone else's keyboard behave the way you want it to. I ran into the same issue for my emoji keyboard, so I have started asking around the open source keyboard communities to make the emoji button configurable so that pressing it should take the user his/her choice of emoji keyboard. Maybe you can vote it up [here](https://github.com/AnySoftKeyboard/AnySoftKeyboard/issues/868) – flide Feb 05 '17 at 15:38

0 Answers0