机器人如何改变shcedule后TimerTask的间隔? [英] Android how to change a TimerTask interval after shcedule?
本文介绍了机器人如何改变shcedule后TimerTask的间隔?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
timerUploadTime = new Timer();
timerUploadTimeTask = new TimerTask() {
@Override public void run() {
mHandler.post(new Runnable() {
@Override
public void run() {
...
}
}
});
}
};
timerUploadTime.schedule(timerUploadTimeTask, 1, Integer.parseInt(Utils.loadStringValue(mycontext, "refresh")));
我想改变我的定时器的时间间隔,在其他code段。有没有办法做到这一点? 我不希望我再定时code,我想补充一个新的期的时间间隔。
I'd like to change my timer's interval, in an other code segment. Is there a way to do that? I dont want to retiming my code, i would like to add a new "period" interval.
我如何能做到这一点的时间表后?
How can I do that after schedule?
推荐答案
您不能。你必须取消当前任务并重新安排。
You can't. You'll have to cancel the current task and reschedule.
这篇关于机器人如何改变shcedule后TimerTask的间隔?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文