Need help with laptimes on stopwatch

Hello everyone
I am very new to App Inventor and need some guidance.
I'm building an app to keep track of interruptions of the workflow. And I am building it like a multiple stopwatches that do something like lap times, where every lap is an interruption.
I managed to make the stopwatches to run and stop - for the first interruption. But when I press again the start button, the time resets - which is not what I need. I need that it runs continously.

Also, at the end of the day I need to sum up all the timers, of the laps - to put it simple, and make a report with these values, of each and every lap times.

While I've managed to make the timers, to count how many interruptions (how many times each START button was pressed), I am missing the problems presented earlier.
Also managed to save each value in TinyDB but don't know how to put them in some sort of report: csv or text, and how to retrieve such report.

Thank you in advance for any type of help or suggestions.

buttons example

You need to rename your procedure to something like 'NN' to distinguish it from other procedures and to provide a hint as to what it does (make a 2 digit number).

You did not show your TinyDB blocks.

Hello Erick

Simplify the stop watch code as per this example:
StopWatchHMS_2.aia (4.9 KB)

I think that adding a third button, 'Resume' might be the way to go. On Stop, save the current values, on Resume, restore the current values.

That procedure block it's the only procedure I have, never thought that I need to distinguish it.

This are my TinyDB blocks. I've figured this way.

You are right, getting rid of mills should ease the problems when need to sum up the time. About the third button, for matter of space I think I will do a "when button longclick do" to give it the third function, of resume.

What I think is considering duration in terms of Millis would be good as base unit, while saving into TinyDB and reterving the same. Since, milliseconds will provide ease to expends to hours, muniets and seconds and vice versa. Instead of Millis you can take seconds as base uinit for your duration. It also help you to sumup the time

At least a few things / questions need to be clarified in advance:

  1. How long are the timers (stopwatches) needed (seconds, minutes, hours)? The question is relevant to knowing whether the timer(s) must also be running in the background (since running in the background in Doze mode causes the timer to stop working).

  2. What exactly is the goal? Are only the split times needed and can the stopwatches continue or should they pause/stop?

  3. What should happen with the split times / total running times at the end? What are these needed for?

Try this:
stopwatch_splitTimes_Anke.aia (8.2 KB)


Hey. Thanks for replying. So:

  1. The amount of overall stops shouldn't exceed 2 hours. All the timers, all the stops on the work flow, should not exceed 2 hours.
  2. I need split times so the stopwatches need to stop and, at the end of the day, I need the sum of all those split times (btw - thanks for the proper name).
  3. Also, when the day ends I need a detailed report of those split times and how many are.

In order for this to work on all devices (Android > 5, Doze mode) it must remain in the foreground during this period (i.e. not go into idle mode or you must use a Foreground service).

Test my aia and adapt it to your needs and then come up with further questions if necessary.


It sound like you are going to create app to log study hours for specific subjects or someting simillar job, isn't it?

You can have some help from

1 Like

I think that's risky - but you can test it.

EDIT: If GUI space is a concern, use image buttons instead of text.
Start Resume Stop

1 Like