androidimeandroid-input-method

Programatically change keyboard from custom android keyboard


I have created an android custom keyboard. After pressing a button on it, I'd like it to change the keyboard back to the previous keyboard, presumable using InputMethodManager.setInputMethod(IBinder token, String id);

However, I can't work out where to get the token from - using getCurrentInputBinding().getConnectionToken() doesn't work.

Does anyone know where to find the token?

Thanks,

Ed


Solution

  • Turns out that the switchInputMethod(String id) method works a treat - no need for that token.