Although there are answered questions about this, none REALLY answers the following: I want the android chronometer to start from the last stop, NOT to continue counting time. I try the following, but IT DOES NOT WORK :-(
public class MainActivity extends ActionBarActivity {
long stopTime = 0;
public void startChronometer(View view) {
long elapsedTime = SystemClock.elapsedRealtime() - stopTime;
((Chronometer) findViewById(R.id.mycrono)).setBase(elapsedTime);
((Chronometer) findViewById(R.id.mycrono)).start();
}
public void stopChronometer(View view) {
stopTime = findViewById(R.id.mycrono).getBaseline();
((Chronometer) findViewById(R.id.mycrono)).stop();
}
............. // standard android methods
results crazy numbers...