I have this following code :
Timer timer = new Timer();
TimerTask task = new TimerTask() {
@Override
public void run() {
// TODO Auto-generated method stub
}
};
timer.schedule(task, 10000);//execute after 10 seconds
Can we determine whether the task is already executed by the timer or is still due?
Add a simple variable like..
boolean isTaskCompleted = false;
Timer timer = new Timer();
TimerTask task = new TimerTask() {
@Override
public void run() {
// do stuff
isTaskCompleted = true;
}
};
timer.schedule(task, 10000);//execute after 10 seconds