Code example for TimeUnit

Methods: toHours, toMinutes, toSeconds

0
		this.recordingLength = 0;
		this.recordingTimerUpdater.run();
	} 
	 
	private void onRecordingTimerTick() { 
		final long h = TimeUnit.SECONDS.toHours(this.recordingLength);
		final long m = TimeUnit.SECONDS.toMinutes(this.recordingLength) - (TimeUnit.SECONDS.toHours(this.recordingLength)* 60);
		final long s = TimeUnit.SECONDS.toSeconds(this.recordingLength) - (TimeUnit.SECONDS.toMinutes(this.recordingLength) *60);
		++this.recordingLength;
		updateRecordingLength(h, m, s);
	} 
	 
	//UI THREAD ONLY 
	private void updateRecordingLength(final long h, final long m, final long s) {
		if (h > 0) {
			this.statusView.setText(String.format("Recording %02d:%02d:%02d", h, m, s));
		} else { 
			this.statusView.setText(String.format("Recording %02d:%02d", m, s));
		} 
	}