Code example for Chronometer

Methods: setText, getBase

0
        c = (Chronometer) findViewById(R.id.timer);
        c.setText("00:00:00");
         
        c.setOnChronometerTickListener(new OnChronometerTickListener(){
			public void onChronometerTick(Chronometer arg0) {
				long t = SystemClock.elapsedRealtime() - arg0.getBase();
		        arg0.setText(DateFormat.format("kk:mm:ss", t));
			} 
        	 
        }); 
         
    } 
 
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_stopwatch, menu);
        return true; 
    } 
     
     
    public boolean dispatchTouchEvent(MotionEvent mEvent){
		super.dispatchTouchEvent(mEvent);