如何设置只有秒和小数的倒数计时器?
例如:39(秒),9(十进制)
这是我目前的代码!
class IfStatement extends Symbol {
Symbol condition;
Symbol ifBranch;
Symbol elseBranch;
@Override int evaluate() {
if (condition.evaluate() != 0)
return ifBranch.evaluate();
else
return elseBranch.evaluate();
}
}
class AddExpression extends Symbol {
Symbol left;
Symbol right;
@Override int evaluate() {
return left.evaluate() + right.evaluate();
}
}
非常感谢您的帮助!
答案 0 :(得分:1)
new CountDownTimer(40000, 1) {
public void onTick(long millisUntilFinished) {
timer.setText("" + millisUntilFinished / 1000 + ":" + (millisUntilFinished % 1000) / 10 + " sec");
timer.setClickable(false);
}
public void onFinish() {
timer.postDelayed(new Runnable() {
public void run() {
}
}, 1000);
timer.setText("Start again");
timer.setClickable(true);
}
}.start();
}
}); // end timer
这应该有用,干得好!
答案 1 :(得分:0)