简体   繁体   English

黑莓:拨轮定格侦听器

[英]Blackberry: trackwheel stop motion listener

I'm implementing an app that has a MapField , which I am extending. 我正在实现一个具有MapField的应用程序,该应用程序正在扩展。

I'm using navigationMovement(int dx, int dy, int status, int time) to move around this map (besides touchEvent(TouchEvent event) which i dont have a problem with). 我正在使用navigationMovement(int dx, int dy, int status, int time)在此地图上移动(除了touchEvent(TouchEvent event) ,我没有问题)。

The problem is that I want to do something when the user stops moving using the trackwheel , but I can't find a listener for this like the TouchEvent.UP for example. 问题是,我想,当用户停止使用移动做一些事情trackwheel ,但我不能找到一个listener喜欢这个TouchEvent.UP的例子。

Does anyone have an idea of what I can use to detect this? 有人知道我可以用来检测到什么吗?

Thanks in advance! 提前致谢!

I'm not (yet) that familiar with BlackBerry-programming, but I don't remember seeing a listener for that anywhere. 我还不熟悉BlackBerry编程,但是我不记得在任何地方都可以看到它的监听器。

One way I could think of to accomplish this could be to create a TimerTask , and store a timestamp in some class-variable when the TrackWheel moves (when your navigationMovement is called). 我可以想到的一种方法是创建一个TimerTask ,并在TrackWheel移动时(在调用navigationMovement时)将时间戳存储在某个类变量中。 Then in the navigationMovement, set the timestamp when the movement occurred (from the time-parameter passed to the method), and start a TimerTask which would then check after a while if the timestamp is marked a certain amount of time back (the wheel has not moved since), and if so, you know the trackwheel has stopped. 然后在navigationMovement中,设置发生移动时的时间戳(从传递给方法的时间参数中),并启动TimerTask,该任务将在一段时间后检查时间戳是否标记了一定的时间(车轮已经自此之后没有移动),如果是这样,则说明拨轮已停止。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM