在我的應用我有一個timer.i後暫停計時器想獲得自身暫停定時器60後secs.can任何一個可以幫助我out..this是我做了什麼如何在固定的時間
private Runnable updateTimerThread = new Runnable() {
public void run() {
timeInMilliseconds = SystemClock.uptimeMillis() - startTime;
updatedTime = timeSwapBuff + timeInMilliseconds;
int secs = (int) (updatedTime/1000);
mins = secs/60;
secs = secs % 60;
int milliseconds = (int) (updatedTime % 1000);
/*timerValue.setText("" + mins + ":"
+ String.format("%02d", secs) + ":"
+ String.format("%03d", milliseconds));*/
timerValue.setText("" + mins + ":"
+ String.format("%02d", secs));
customHandler.postDelayed(this, 0);
}
};
你需要停下來記住舊值,並重新與舊值再次運行當需要時 – Raghunandan
你不能暫停計時器,而是@Raghunandan說 – Hardik