Create Stopwatch App in Android using Sketchware

Timer component and number variables can be used to add a Stopwatch to your Android App created in Sketchware. To create a Stopwatch App in Sketchware follow the steps below.

1. Start a new project in Sketchware. Fill app name, package name and app icon.

2. In VIEW area, insert a Textview and a Button widget. In Textview properties set layout_gravity as center_horizontal, text as 00:00:00.00, and text_size as 40sp. In Button properties set layout_gravity as center_horizontal, text as Start/Stop/Reset and text_size as 20sp.

3. In LOGIC area add a new timer component t.
4. In onCreate event, add five number variables, one each for hour, minutes, seconds, and milliseconds, and an extra variable for managing Button Click. Set all these number variables to 0.

5. Suppose the five number variables are named as h, m, s, ms, and start.

6. Then in Button​ onClick event use if..then..else control as shown in the image below.

This will change variable start to 1 on first Click, 2 on second click, and 0 on third click, thus making the button act as Start, stop and reset button respectively on the three clicks.

On third click when variable start changes from 2 to 0, set all other variables to 0, so that it acts as reset button.

7. In the starting if start=0, add a timer task for 10ms after every 10ms and use the blocks as given below:
If start=0 then
set start to 1
TimerTask t after 10ms for every 10ms
Number ms increase 1
If ms=100 then
set ms to 0
Number s increase 1
If s=60 then
set s to 0
Number m increase 1
If m=60 then
set m to 0
Number h increase 1
8. On Button Click, if start=1, set start to 2, and cancel timer task. If start=2, set start to 0, and set all other variables to 0.
9. Use join..and... operator, number variables, and Decimal format... operator to set the text of textview as shown in the image below.
10. Use setText of textview inside timer task, and inside if start=2.
11. Save and run the project. The Stopwatch App is ready.
The video below shows the complete process:


  1. The time is reset when screen turn off.

  2. This comment has been removed by the author.

  3. Hello Floks!
    Online Stopwatch Countdown Timer
    September 24, 2020
    It's a really nice tool Stopwatch App so what you can do here by the timeline - stopwatch slash countdown timer is that you can put this into full-screen mode so you got down here in the bottom and use the timer in full-screen mode so I'm gonna go ahead Learn More


Post a Comment

Popular posts from this blog

Create Music Player app in Sketchware

A Flash Light App in Sketchware

Admob rewarded video Ads in Sketchware

Simple car racing android game in Sketchware

Firebase auth in Sketchware for Login Activity