Can I use Android InputMethodManager on a custom keyboard in an application?

InputMethodManager is a service that applications can use to interact with system keyboards. Editors such as EditText also use it to indirectly notify change keyboards (for example, updateSelection ).

I can get a link to InputMethodManager , like this

 InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); 

My problem is that it looks like system keyboards. Can I use InputMethodManager for a custom keyboard in an application ? If it were only for one isolated application, I would not care, but I include the user keyboard in the library, which will be used in many applications. I need a standard way for editors to interact with the keyboard.

Do I have to write my own input method manager or is there a way to use the standard InputMethodManager with my user keyboard in the application?

Update

Here are some tips on how I could implement my own input method manager if I cannot use the standard one.

+7
android keyboard custom-keyboard inputmethodmanager
source share
2 answers

You must realize yours.

InputMethodService provides a standard implementation of InputMethod from which final implementations can arise and customize. See the AbstractInputMethodService Base Class and the InputMethod Interface for more information on the basics of writing input methods.

+1
source share

No, you can’t. Because if you inherit from InputMethodService , your keyboard will be available for other applications. There is only one way to create a built-in keyboard; it uses a simple View in your layout. In this example, the user keyboard in the application they use InputMethodManager to connect to the EditText .

+1
source share

All Articles