开发者

Receiving trackball events with an Android NativeActivity

开发者 https://www.devze.com 2023-04-03 14:29 出处:网络
I have a NativeActivity-based application that wants to receive trackball events. According to the (sketchy) documentation, I should be receiving these via the struct android_app\'s onInputEvent() ca

I have a NativeActivity-based application that wants to receive trackball events.

According to the (sketchy) documentation, I should be receiving these via the struct android_app's onInputEvent() callback, the same as I do for key and motion events. However, I'm not getting any. Looking at the tracing the event gets sent to the glue layer but is apparently consumed by the call to AInputQueue_preDispatchEvent() in process_input(), and so never gets delivered to my application.

Has anyone gotten trackball events working with NativeActivity, and if so开发者_开发百科, how?


you can override onKeyDown() and use KEYCODE_DPAD_DOWN,KEYCODE_DPAD_LEFT,KEYCODE_DPAD_RIGHT,KEYCODE_DPAD_UP to handle all event . I was using it for a game on HTC desire device.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号