as the title said i'm using the chronometer with Xamarin, but here is my problem : it's impossible to set the chronometer to 00:00. I tried the method to set the base to 0 but it didn't work.
Here is my code :
Chronometer chrono = FindViewById<Chronometer>(Resource.Id.chronometer1);
void startButton(object sender, EventArgs e) {
chrono.Visibility = Android.Views.ViewStates.Visible;
buttonStop.Enabled = true;
chrono.Base = 0;
chrono.Start();
}
But when i start the chrono it starts from the SystemClock.elapsedRealtime().
Is anyone has an idea ?
Thank you.
In order to start from 0
, assign it the current time so the delta time is 0
.
chrono.Base = SystemClock.ElapsedRealtime();
You can give it a start time in the elapsedRealtime() timebase, and it counts up from that, or if you don't give it a base time, it will use the time at which you call start().
re: https://developer.android.com/reference/android/widget/Chronometer.html