Thunder Storm Thunder Storm - 1 year ago 327
Android Question

How to get current InputMethodService

How can I get the InputMethodService of the default InputMethod?

I already tried this but I don't know how to get the InputMethodService by an InputMethodInfo:

InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
List<InputMethodInfo> mInputMethodProperties = imm.getEnabledInputMethodList();

final int N = mInputMethodProperties.size();

for (int i = 0; i < N; i++) {

InputMethodInfo imi = mInputMethodProperties.get(i);

if (imi.getId().equals(Settings.Secure.getString(getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD))) {

//imi contains the information about the keyboard you are using

Are there any other solutions I overlooked?

Answer Source

You cannot "get" the InputMethodService, as it is running in a different process than yours.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download