Search code examples
androidandroid-softkeyboardimeandroid-inputtype

Android custom IME for specific InputType


I am currently developing an IME which generate me a dynamic password based on my input. I used the sample SoftKeyboard in order to undertake this project.

When I need to type a password, I just need to change the Input Method and for now, it seems to be ok.

My question is quite simple. Is there a way to allow this IME only when the InputType is a password type like (InputType = TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD) Or would there be a method to specify a specific keyboard (in this case my IME) when InputType is a password type?

Thank you !


Solution

  • Nope. There's 2 things that control the IME. First, the user sets a single default IME for the phone. There is no way to split this up by type or anything else. Second, the app can request a specific IME for a text field. Usually this is done only if the app itself is providing that IME. There is no way for a keyboard to make itself the default, or for it to override the default for a type.