I'm trying to convince an EditText
-view to only use the SoftKeyboard that I wrote. It's bugging me for a few days already and I can't believe that this isn't possible to do. I might not see the obvious...
So far I managed to write my own SoftKeyboard based on the sample that comes with the Android SDK. I'm able to manually select it as the input method (long click, input method, *pick*). The SoftKeyboard then works fine and does everything I want. I also cleaned up the context menu to disallow changing the input method (obviously I currently needed it to be in the menu otherwise I wouldn't be able to choose my SoftKeyboard).
In other words the only thing left is to tie the SoftKeyboard to the EditText
.
I noticed the bunch of ime*
-attributes on the EditText
, but they don't seem to be useful for my problem as I don't want to change anything about the action key. inputMethod
requires a KeyListener
, which the SoftKeyboard is not (I tried to make it one, but there seems to be a problem with the class-loader as it wouldn't find my class => ClassNotFoundException
).
Can anyone please point me to some useful information?
I'm currently reinventing my approach and try to work without the
InputMethodService
. I keep the sample code as a reference for handling the user input. Basically it should just be a simple view that pops up when needed.After further research I found a really helpful question about an App-specific soft-keyboard. If you run into my situation, look there.
What I suspect that you wrote was an input method editor, based on your "manually select it" note. This is a global construct, available for the user to elect to install and use if desired. And your input method editor could be used, at the user's discretion, in any application in the device.
You, in your application code, cannot mandate a particular input method editor, whether you wrote it or not.
What you could do, perhaps, is arrange to use the same UI from your input method editor as some sort of pop-up in your activity. For example,
KeyboardView
, according to Ms. Hackborn, is a standardView
and can be used like any other. The user could tap a button next to yourEditText
to display your keyboard UI (e.g., animated slide up from the bottom of the screen), or something like that.Please allow the user to choose the input method, or do not use an
EditText
.