Code example for TimeUnit

Methods: toHours

0
	 *            number of milliseconds that have passed. 
	 * @return formatted string 
	 */ 
	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);
	} 
 
	@Override 
	public boolean onTouchEvent(MotionEvent event) {
		show(sDefaultTimeout);
		return true;