When you switch screens the timer will stop working.
Two options
1. Staying with multiple screens, capture the time of start of the activity to a variable, then before switching screens capture the time again. Save these values to a tinydb. When you return to the same screen again, start the capture time process again and add to the previous values.
2. Get rid of all the multiple screens a just use vertical or horizontal arrangements as virtual screens and change their visibility as you switch virtual screens.
Read all this:
Use different screens wisely
(Thanks Taifun)