- A simple efficient stopwatch timer Android application built using Java.
- This app provides precise timing functionalities and a user-friendly interface for tracking time durations accurately.
Add Chronometer to Layout: Include the Chronometer widget in your layout XML file.
<Chronometer
android:id="@+id/chronometer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:format="HH:mm:ss"
android:textSize="48sp" />
How to operate Chronometer by programmatically?
Initialize Chronometer
Chronometer chrnMeter = findViewById(R.id.chronometer);
Start/Resume Chronometer
chrnMeter.start();
Pause Chronometer
chrnMeter.stop();
Reset Chronometer to 00:00
chrnMeter.setBase(SystemClock.elapsedRealtime());
// after reset value to 00:00 above setBase() restart the timer not just reset. so it's important to stop after resetting value.
chrnMeter.stop();