开发者

closing timer in blackberry

开发者 https://www.devze.com 2023-01-07 13:39 出处:网络
I am developing an application for blackberry. I have a timer, when I declare it as static & close the timer after ce开发者_StackOverflow社区rtain interval, it works. If i don\'t declare the timer

I am developing an application for blackberry. I have a timer, when I declare it as static & close the timer after ce开发者_StackOverflow社区rtain interval, it works. If i don't declare the timer as static and call timer.cancel(), the timer is not closed. Why is this happening?


At a wild guess I would say you are closing the timer from a different instance of the class it is part of. When it's static they are the same timer. When it isn't, it isn't.


You can cancel the timeSchedule for the TimerTask(), by calling the method cancel();

0

精彩评论

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