由网友(淡墨无殇)分享简介:我怎样才能暂停 handler.postDelayed()定时器使用一个按钮。所以,当我点击该按钮再次 handler.postDelayed()计时器应该恢复。 handler.postDelayed(counterz,60); 解决方案 处理程序没有一个定时器来调整。您张贴到一个线程,那里有很多其他的东西也运行...
我怎样才能暂停 handler.postDelayed()
定时器使用一个按钮。所以,当我点击该按钮再次 handler.postDelayed()
计时器应该恢复。
handler.postDelayed(counterz,60);
解决方案
处理程序
没有一个定时器来调整。您张贴到一个线程,那里有很多其他的东西也运行正常的事件队列中。
您可以取消发布的Runnable
的:
handler.removeCallbacks(counterz);
和再次发布,恢复。
How can i pause the handler.postDelayed()
timer using a button. So when i click the same button again the handler.postDelayed()
timer should resume.
handler.postDelayed(counterz, 60);
解决方案
Handler
does not have a timer to tweak. You are posting to event-queue of a thread, where a lot of other stuff is running as well.
You can cancel posted Runnable
's:
handler.removeCallbacks(counterz);
And post again, to resume.
相关推荐
最新文章