停止计时器后如何敬酒?
onCreate {
//other code
myTimer = new Timer();
myTimer.schedule(new TimerTask() {
@Override
public void run() {
TimerMethod();
}
}, 0, 1000);
Toast.makeText(getApplicationContext(), "AS", 455).show();
}
private void TimerMethod()
{
this.runOnUiThread(Timer_Tick);
}
private Runnable Timer_Tick = new Runnable() {
public void run() {
rub_stat++;
if (rub_stat == 15){myTimer.cancel(); } }
};
所以在 rub_stat 达到 15 后,我想取消计时器并让 toast 出现。提前致谢!