Code example for TimeUnit

Methods: toHours

0
			progressHandler.postDelayed(this, 1000); 
		} 
 
		protected String formatDuration(long duration) { 
			long tempdur = duration; 
			long hours = TimeUnit.MILLISECONDS.toHours(duration); 
 
			tempdur = tempdur - (hours * MILLISECONDS_PER_HOUR); 
 
			long minutes = tempdur / MILLISECONDS_PER_MINUTE; 
			tempdur = tempdur - (minutes * MILLISECONDS_PER_MINUTE); 
 
			long seconds = tempdur / 1000; 
 
			return String.format("%02d:%02d:%02d", hours, minutes, seconds); 
		} 
 
		private void setProgress() { 
			if (mediaPlayer == null) { 
				return; 
			}