I'm using postDelayed
method of the Handler
in order to perform an action after certain amount of time:
private static int time_to_wait = 2000;
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
public void run() {
// Make Action
}
}, time_to_wait);
now in the middle of the waiting time i want to change the value of the remaining milliseconds due to some processing results, let's say it now waited 1000 ms and i want to make it begins to count from 2000 again, So, i set the time_to_wait
value to 2000 but it doesn't take that in count as it only takes the var value (2000) and just waits that time regardless changing the time_to_wait
value to any other value.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…