This is how i start the chronometer:
btnCount.setEnabled(true);
if (!mIsStarted) {
chrono.setBase(SystemClock.elapsedRealtime());
chrono.start();
mIsStarted = true;
}
and then I stop it by:
switch (item.getItemId()) {
case R.id.item1:
Toast.makeText(getApplicationContext(),"Count Reset",Toast.LENGTH_LONG).show();
txtCount.setText(String.valueOf(count = 0));
chrono.setBase(SystemClock.elapsedRealtime());
return true;
default:
return super.onOptionsItemSelected(item);
I have tried everything I understand, but can not restart the chronometer on the button click after i press the reset menu button, instead it stays at 00. I understand that this is most likely because of
if (!mIsStarted) {
...
mIsStarted = true;
which allows the button to only interact with the chronometer once. Is there a way to allow the button to start the chronometer after it has been reset? Thanks