I am working on a simple Chronometer app and I was wondering how to check if a chronometer is running. For example I have the below method to start the Chronometer but if pressed I want it to check to see if it is already running and if it is to display a warning. I know I would use an IF statement but I am not sure how to check to see if the chronometer is running. Any help is appreciated.
I now have the below code. It starts the chronometer but if its already running the button just resets it instead of stopping it.
boolean crun = false;
if(crun = true){
chronometer.setBase(SystemClock.elapsedRealtime());
chronometer.start();
crun = true;
Vibrator vib = (Vibrator)getSystemService(Context.VIBRATOR_SERVICE);
vib.vibrate(100);}
else {
chronometer.stop();
crun = false;
}