I need to run asynk task till two minutes in interval of every fiften seconds . Is there any way to do this ?
Asked
Active
Viewed 55 times
-4
-
Try using timerTask – Akshay Bhat 'AB' Jul 22 '16 at 06:05
1 Answers
2
try like this
void TimerTask(int count)
{
if(count>8) // 8 cyclses,because 60*2/15
return;
Timer myTimer = new Timer(); // Create timer
myTimer.schedule(new TimerTask() {
@Override
public void run() {
// run your async task there
TimerTask(count++); //OnExecute
}
}, 0L, 15L * 1000);//every 15 sec (0L - seconds waiting for start)
}
` Call it - TimerTask(0);

Alex
- 66
- 8
-
-
i need to modify small thing if i got status '00' till 2 minuts i need to escape out from time , how to do this ? – Dinesh Rijal Aug 07 '16 at 17:17