如何模拟触摸事件并将其发送到前台活动(在设备上)
我希望能够将触摸事件发送到前台 Activity。 假设我无法控制前台 Activity。例如,将触摸事件发送到 Android Gallery Activity 甚至主菜单。
我读到有一些方法可以在 TouchUtils 下执行此任务 - 使用 ActivityInstrumentationTestCase2,它更像是一个自动化测试工具。 只要我可以启动设备附带的 OEM 活动并向它们发送模拟触摸事件,我就愿意走这条路。
有办法这样做吗? MotionEvent 中有什么可以提供帮助的吗? (除了创建实际的触摸事件)
感谢您的帮助,
Ita
I wish to be able to send touch events to the foreground Activity.
Assume that I don't have control over the foreground Activity. For example sending touch events to Android Gallery Activity or even the Main Menu.
I've read that there are ways to perform this task under TouchUtils - using ActivityInstrumentationTestCase2, which a more of an automated testing tool..
I'm willing to go down this road as long that I can launch the OEM Activities that arrives with the device and send them the simulated touch events.
Is there a way to do so? Is there anything in MotionEvent that could help? (other then creating the actual touch event)
Thanks for helping,
Ita
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论