【发布时间】:2016-04-13 12:34:28
【问题描述】:
我想做一个像 app 这样的 cookie 点击器,我需要一个简单的随时间递增的函数。 但我只希望在按下按钮后 int 开始增加。 我试过了,但不能正常工作。
int delay = 5000;
int period = 1000;
int count = 0;
Timer timer = new Timer();
timer.scheduleAtFixedRate(new TimerTask()
{
public void run()
{
count++;
score.setText(String.valueOf(count));
}
}, delay, period);
【问题讨论】:
标签: android time timer increment