2
どのようにこのタイマーを停止するには?androidでCountDownTimerを停止する方法
すべてのクエリでタイマーをリセットしますが、続行します。新しいクエリごとに新しいタイマーが追加されます。これを解決するには?
new CountDownTimer(zaman, 1000) { //geriye sayma
public void onTick(long millisUntilFinished) {
NumberFormat f = new DecimalFormat("00");
long hour = (millisUntilFinished/3600000) % 24;
long min = (millisUntilFinished/60000) % 60;
long sec = (millisUntilFinished/1000) % 60;
cMeter.setText(f.format(hour) + ":" + f.format(min) + ":" + f.format(sec));
}
public void onFinish() {
cMeter.setText("00:00:00");
}
}.start();
内
this.cancel()
または単にcancel()
を呼び出すことができますので、多くのyourCountDownTimerありがとう。キャンセル();作品 – Tahaようこそ。それは私の答えを受け入れるのに役立ちます@ Taha –
yourCountDownTimer.stop()?それは.cancel()でしょうか? –