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();
精彩评论