Android Question Timer handling

gezueb

Active Member
Licensed User
Longtime User
I have an app that uses a timer to blink a label on a panel asking for user interaction.
On restart or resume of the app the timer is enabled again.
However, very often but not always, the tick event will fire before the panel and label has had a chance to be initialized which causes an exception.
Is there a way to make sure the timer has no pending events on restart?
Thanks for help! Georg
 

DonManfred

Expert
Licensed User
Longtime User
Stop all running timers on Activity_pause
Resume all needed timers in activity_resume
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
In the timer event check if label.isinitialized is true, if it is not, do nothing. This will ensure that the tick event code will only be run if the label is initialized
 
Upvote 0

udg

Expert
Licensed User
Longtime User
You may want to have a look at my lib's dgTextEffects.
It sports a flashing label that doesn't need a timer (you start/stop the flashing at will).

udg
 
Upvote 0
Top