Code example for Chronometer

Methods: setBasestartgetText

0
			@Override 
			public void onClick(View arg0) {
				 
				long stoppedMilliseconds = 0;
				 
				String chronometerText = timeWaitingChronometer.getText().toString();
				String array[] = chronometerText.split(":");
				 
				if(array.length == 2){
					stoppedMilliseconds = Integer.parseInt(array[0]) *60*1000 + Integer.parseInt(array[1])*1000;
					 
				} else if (array.length == 3){
					stoppedMilliseconds = Integer.parseInt(array[0]) *60*60*1000 + Integer.parseInt(array[1])*60*1000 + Integer.parseInt(array[2])*1000;
					 
				} 
				timeWaitingChronometer.setBase(SystemClock.elapsedRealtime() - stoppedMilliseconds);
				 
				secondsWaited = Long.parseLong(array[1]);
				 
				updateTipBasedOnTimeWaited(secondsWaited);
				 
				timeWaitingChronometer.start();
			} 
 
			 
			 
		}); 
Connect your IDE to all the code out there  Get Codota for Java