BlackBerry Unable to close camera using EventInjector for touch screen

解决BlackBerry相机关闭问题
本文介绍了一种在BlackBerry设备上使用EventInjector关闭相机应用的解决方案。通过在两次注入ESC键事件之间加入500毫秒的延迟,能够稳定地实现关闭相机的功能。此方法仅适用于post()方法。

http://supportforums.blackberry.com/t5/Java-Development/Unable-to-close-camera-using-EventInjector-for-touch-screen/m-p/785247#M143879

 

So I believe I have found a way to make this work consistently.  My issue was not the permissions, as all along I was testing with the proper permissions set (or by prompting hte user to set them).  The solution I found is to put a Thread.sleep(500) between the two injected ESCAPE events as follows:

 

 

EventInjector.KeyEvent inject = new EventInjector.KeyEvent(EventInjector.KeyEvent.KEY_DOWN, Characters.ESCAPE, 0);
inject.post();
sleep(500);
inject.post();





 I'm not exactly sure why this works, and I'm not saying that it's the right way to solve the problem, but it works for me.  I tried shorter sleep times but 500ms was the shortest that I could get to consistently work.  Also, this didn't work when I used the EventInjector.invokeEvent() method, only with the post() method.  Hope this helps some people out.

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值