Timer and TimerTask in Android
22,867
You need to cancel() timer not the timer task.
Related videos on Youtube
Author by
Scit
Updated on July 09, 2022Comments
-
Scit almost 2 years
I need a timer for my program. I have written it and it works fine on PC in emulalator program (Android 1.5/2.2). But it doesn't work on the real device (Android 1.5). What am I doing wrong?
TimerTask task = new TimerTask() { public void run() { if (condition) { myFunc(); } else { this.cancel(); } } }; Timer timer = new Timer(); timer.schedule(task, 500, 85);
-
Rasel almost 13 yearsGo through this android-controlling-a-task-with-timer-and-timertask
-
Felix Kling almost 12 yearspossible duplicate of Android - Controlling a task with Timer and TimerTask?
-