Mad 2
Mad 2
The microproject aims to develop a stopwatch Android application that provides users with a simple tool
for measuring time intervals. The application will include features such as start, stop, and reset buttons,
along with a display area to show the elapsed time. By incorporating a button for starting and stopping the
stopwatch, a reset button for clearing the elapsed time, and a TextView widget to display the current time,
users can easily utilize the stopwatch functionality for various timing needs.
➢ Hardware Requirements
✓ RAM- 16 GB
➢ Software Requirements
✓ Operating system – Windows 10
✓ Android Studio
4
CODE:
<TextView
android:id="@+id/timer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="00:00:00"
android:textSize="48sp"
android:textStyle="bold"
android:layout_centerHorizontal="true"
android:layout_marginTop="100dp" />
<Button
android:id="@+id/startButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Start"
android:layout_below="@id/timer"
android:layout_centerHorizontal="true"
android:layout_marginTop="40dp"/>
5
<Button
android:id="@+id/pauseButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Pause"
android:layout_below="@id/startButton"
android:layout_marginTop="20dp"
android:layout_centerHorizontal="true"/>
<Button
android:id="@+id/resetButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Reset"
android:layout_below="@id/pauseButton"
android:layout_marginTop="20dp"
android:layout_centerHorizontal="true"/>
</RelativeLayout>
6
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
timerTextView = findViewById(R.id.timer);
startButton = findViewById(R.id.startButton);
pauseButton = findViewById(R.id.pauseButton);
resetButton = findViewById(R.id.resetButton);
runTimer();
resetButton.setOnClickListener(v -> {
running = false;
seconds = 0;
7
});
}
if (running) {
seconds++;
}
handler.postDelayed(this, 1000);
}
});
}
}
8
Output
9
Conclusion
the development of the stopwatch Android application has provided valuable insights into creating
interactive user interfaces and implementing functionality in Android Studio. Through this project,
I gained hands-on experience in designing layouts, handling user input, and managing timer
functionality. Special thanks to Prof. A.L. Devkate me through this project and providing an
opportunity to explore and enhance my skills in Android app development. This project not only
allowed me to apply theoretical knowledge but also encouraged creativity and problem-solving
skills. Overall, it has been a rewarding experience, and I look forward to further exploring the
world of mobile app development.
Reference
• www.google.com
• www.javtpoint.com
• www.tutorialspoint.com
• www.wikipedia.com
10