I have custom InputMethod that have a BroadcastListener in it. When the listener catches an intent in onReceive() method I call the onKey method of my InputMethod and in that way I simulate a key press from the softkey board. If I call onKeyDown or onKeyUp then I simulate the hardware keyboard. So this is a solution that I dont like.
Yesterday I found this: http://mylifewithandroid.blogspot.com/2009/01/generating-keypresses-programmatically.html
Is it a good idea to use Instrumentation.sendKeyDownUpSync to simulate key press and it is working perfectly, I don't even need to implement my own InputMethod. I mean this Instrumentation is provided fo开发者_如何学运维r testing purpose as I understand.
Is it a good idea to be used in way I do?
I think it's too much to use your own IME to test your application.
You already have a way to do it with Android's Instrumentation.
You can also check Robotium which might be useful for what you are trying to test.
加载中,请稍侯......
精彩评论