使用 Android NativeActivity 接收轨迹球事件
我有一个基于 NativeActivity 的应用程序想要接收轨迹球事件。
根据(粗略的)文档,我应该通过 struct android_app
的 onInputEvent()
回调接收这些,就像我对按键和动作事件所做的那样。但是,我没有得到任何。查看跟踪,事件被发送到粘合层,但显然被 process_input()
中的 AInputQueue_preDispatchEvent()
调用所消耗,因此永远不会传递到我的应用程序。
有没有人使用 NativeActivity 获得轨迹球事件,如果是的话,是如何实现的?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以重写 onKeyDown() 并使用 KEYCODE_DPAD_DOWN、KEYCODE_DPAD_LEFT、KEYCODE_DPAD_RIGHT、KEYCODE_DPAD_UP 来处理所有事件。我在 HTC Desire 设备上用它玩游戏。
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.