i need help in my app i need start stopwatch to keep count the time when i click the in button and even i close the app time keep running until i click out
Please search on Community before create a new topic
thanks for advice i do that but i couldn’t reach what can help me so that i create this topic
store the start time in TinyDB so you always will be able to calculate the duration even if the app was closed temporarily
thanks for your fast respond with me kindly if you please support me with some blocks i will send the aia in attachbackground.aia (3.5 MB)
if you are not able to understand, what I was saying, then please do some tutorials to learn the basics
also please try something yourself and if you got stuck, then post a screenshot of your relevant blocks
A very good way to learn App Inventor or Kodular is to read the free Inventor’s Manual here in the AI2 free online eBook App Inventor 2 Book: Create Your Own Android Apps … the links are at the bottom of the Web page. The book ‘teaches’ users how to program with AI2 blocks.
There is a free programming course here Course In A Box and the aia files for the projects in the book are here: App Inventor 2 Book: Create Your Own Android Apps
How to do a lot of basic things with App Inventor are described here: How do you...? .
i try to learn as i can so I’m apologize if my questions been as stupid or something i will check what you send me and thanks again for your help and support
There’s no stupid questions, some people know some things that others don’t. That’s all.
But you need to learn how to do it yourself. Asking for the blocks is not a good idea because you are not learning, just copying what others do and you will never understand what those blocks do, unless you come up with the solution by yourself.
For @Taifun’s solution, you might want to check the Clock component, save the current time in milliseconds in a TinyDB tag when the app is closed, or suspended.
Then when the app is opened (Screen1.Initialize), check the time saved in TinyDB and compare it with the current time. That will let you know how much time passed since the stopwatch was started.
thanks for your reply i appreciate all support, its greet community and im so happy being here
The duration block accepts INSTANTS blocks, not miliseconds.
Use this block to convert milliseconds to instant
Is that a comma there? It should be only the milliseconds number.
use Do it to debug your blocks
see also tip 4 here App Inventor: How to Learn | Pura Vida Apps
What is not working?
Your blocks look fine, should work, so try this:
duration_test.aia (2.8 KB)
i get the solutiontime.aia (14.9 KB) as attached