This is a simple stopwatch application for Android devices. It is written in Java and allows users to start, stop, and reset a timer. The App also saves the state of the timer even when the app is closed or the device is rotated.
- Start, stop, and reset functionality
- Saving timer state even when app is closed or device is rotated
- easy to use interface
- Clone or download the repository
- Open the project in Android Studio
- Connect an Android device or use an emulator
- Build and run the app on the device/emulator
- Press the "Start" button to begin timing
- Press the "Stop" button to stop the timer
- Press the "Reset" button to reset the timer to zero
- The app saves the state of the timer even when the app is closed or device is rotated
The App uses onSaveInstanceState and onCreate method to save and restore the state of the timer
if(savedInstanceState != null){
savedInstanceState.getInt("seconds");
savedInstanceState.getBoolean("running");
savedInstanceState.getBoolean("wasRunning");
}
@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
outState.putInt("seconds", seconds);
outState.putBoolean("running", running);
outState.putBoolean("wasRunning", wasRunning);
}
If you wish to contribute to this project, please fork the repository and create a pull request with your changes.
This project is licensed under the MIT License - see the LICENSE.md file for details
- Hat tip to anyone whose code was used
- Inspiration
- etc
Please let me know if there is anything else you would like me to include.