Timer running in background after program termination

demasi

Active Member
Licensed User
Longtime User
Hello,
I made a Tetris like game in B4A, its almost finished, but I'm facing a strange problem.:BangHead:

Running the game in Android 4.1.2 when I finish the game, using Activity.Finish, a background thread keeps running. Android says it keeps the app in cache for a faster start, if I want to restart it.

But the problem is, when I run the game again, the active background thread ( I think is this) keeps firing timer events, so the game runs with double, triple, etc. timer events in the same period, making the game run too fast. Each time I terminate the game and restart again, the program runs even faster.

Can someone help me?
Thank you.

Note: I have tested in other android versions, and in all of them this strange behavior happens.
 
Last edited:

stevel05

Expert
Licensed User
Longtime User
You Should use Timer.Enabled = False in Activity_Pause, and if appropriate Timer.Enabled=True in Activity_Resume
 
Upvote 0

demasi

Active Member
Licensed User
Longtime User
Thank you!

It seems that this is the problem.

It's ok now.

Thank you for your help Stevel05.:)
 
Upvote 0
Top