Code example for Chronometer

Methods: getText, setBase, start

0
		} 
 
	} 
 
	private void startChrono() { 
		chrono.setBase(SystemClock.elapsedRealtime() - parseChronoText(chrono.getText().toString()));
		chrono.start();
	} 
 
	private long parseChronoText(String text) {
		long stoppedMilliseconds = 0;
		String array[] = text.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;
		}