Reputation: 7348
How to stop the currently executing task of the timer.? If i use timer.cancel() it will cancel the timer but perform the currently executing task..So is there a way around so that i can cancel the currently executing task??
Upvotes: 3
Views: 6658
Reputation: 11889
Use:
timer.cancel();
timer.purge()
purge() Removes all canceled tasks from the task queue and timer.cancel() cancels the Timer and all scheduled tasks..
Also take a look at This post
Upvotes: 3