Android: Is there any way to turn on-off the physical keyboard programmatically?

你。 提交于 2019-12-04 04:55:19

问题


I have an android 3.1 with usb host capabilities. I connected to it via usb an RFID reader that works as a keyboard emulator. For keyboard emulator I mean that once I scan a tag it sends the output as keystrokes.

Now once this reader is plugged in there is no way to have the soft keyboard visible. So it's impossible to type anything else than the rfid codes.

I have tried without success the examples to "force show soft keyboard": they work until I plug in the RFID reader. Then the soft keyboard disappears no matter what!!!

My software will work on "kiosk mode", that's why I ask about doing this process programmatically. This is not a matter of usability.

Any help is really appreciated.


回答1:


Have you got any editText or similar to get the focus this way?

someEditText.requestFocus();
InputMethodManager mgr = (InputMethodManager)getActivity(). 
getSystemService(Context.INPUT_METHOD_SERVICE);                 
mgr.showSoftInput(someEditText, InputMethodManager.SHOW_IMPLICIT);

I mean, if you do this after plugging your RFID reader, the keyboard should appear. Did you try this?



来源:https://stackoverflow.com/questions/8435295/android-is-there-any-way-to-turn-on-off-the-physical-keyboard-programmatically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!