Code example for Chronometer

Methods: setBase, setOnChronometerTickListener, start

0
        chrono = (Chronometer) findViewById(R.id.chronometer1);
    } 
     
    View.OnClickListener startFibo = new OnClickListener() {
    	public void onClick(View v) { 
    		chrono.setBase(SystemClock.elapsedRealtime()); 
    		chrono.start(); 
    		chrono.setOnChronometerTickListener(new OnChronometerTickListener() { 
 
				@Override 
				public void onChronometerTick(Chronometer arg0) { 
					long minutes = ((SystemClock.elapsedRealtime()-chrono.getBase())/1000)/60; 
					long seconds = ((SystemClock.elapsedRealtime()-chrono.getBase())/1000)%60; 
					currentTime = minutes+":"+seconds; 
					arg0.setText(currentTime); 
				} 
     
    		}); 
    		FiboAsync task = new FiboAsync(); 
    		task.execute(); 
    		startBtn.setClickable(false);