Forum > Android



I have 2 TTimer components on the main form. One is set for 50 ms and the other 1 second. However, they are both running at the same speed, about 100ms. Is this a known problem?
I'm running the code on a Kindle Fire.

That's a problem with how operating systems work. If you put your application to sleep for a while then you only have a ballpark estimate of when it might wake up again. You basically can pretty much never get precise timing on a modern operating system, unless you rely on some sort of hacked busy waiting.

If you need to update the UI precisely for each timer tick you are even worse off, since it might block behind the curtains.

Try to give more details about your program and what behaviour you need this timing for.

I'm taking the firmware from a handlheld datalogger and trying to get it to run in Android. It is partially working. The 1 second timer was for the clock, but I'll have to do it another way by just checking the time every time the TTimer fires.

I have another problem with TTimer. Sometimes the TTimer just stops firing. I have it updating a number in a Tlabel on the screen. When it stops, if I touch the screen then it will catch up, but doesn't start running again on its own unless I kill the app and restart it.


There wasn't a problem with TTimer, I didn't understand the way form events work with Android:

-- Start App for first time
Form create
Form resize
Form show
Form resize
Form Activate

-- Exit and re-enter app or unhandled exception
Form create
-- Global vars and objects stay intact but form vars cleared.

My Timer was on the form, so when  an unhandled exception occurred Form create was called and the timer didn't get restarted.

It would be good if there was an event to signal the user exiting the app.


[0] Message Index

Go to full version