How to get touch events when the user is typing with a soft keyboard on Android
In a research project I need to obtain the touch event when the user is typing with a soft keyboard. It is possible if I draw a soft keyboard on a imageView and set a touchListener for the imageVi开发者_如何学Pythonew, but then I will have to figure out which key the user is typing on. Basically I am reimplementing the soft keyboard. So I was wondering if there is a way that I can set a touchListener for the view of the existing soft keyboard and get both the touch event and the text?
You'll probably want to use a KeyEvent see this: http://developer.android.com/reference/android/view/KeyEvent.html
You can take a look on this post: button events in android
You can find the equivalent class for key events: /android.hci.extractor/src/org/mmi/android/instrumentation/filters/KeyInputFilter.java
The source code is here: - Android HCI Extractor code: http://code.google.com/p/android-hci-extractor/
I hope it helps you!!
I used this event for that:
public void onPress(int primaryCode)
精彩评论