change the default android keyboard using ADB or java code

狂风中的少年 提交于 2019-12-03 07:14:20

问题


I am building a custom application that uses specific keyboard so when the user run the application, the default keyboard should be changed to my specific keyboard which name is hackers keyboard , How can I do that using java code or by calling adb command from java code , my device is rooted , again this is specific app and the company that I developing for require that.


回答1:


You can use the ime command to set input method.

$ adb shell ime
usage: ime list [-a] [-s]
       ime enable ID
       ime disable ID
       ime set ID



回答2:


You could use KeyboardView in your application to open your own Keyboard. Therefore you should overwrite OnTouchListener of for example the edit textbox.

There is no need to have a rooted device nor to use adb. There is also an example in the Android SDK. It is called "SoftKeyboard".

Or you could have a look for an example on this blog post.



来源:https://stackoverflow.com/questions/15253983/change-the-default-android-keyboard-using-adb-or-java-code

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