I have a Metronome application which users a Timer. I've gotten the Timer to work very well, but I've noticed that it is susceptible to getting off the beat once in a while (when something else runs on the phone, I think). I think this can be solved by running the Timer in its own thread (a non-GUI thread). But I'm trying to figure out how to code this. This what I'm thinking:
Sub Process_Globals
Sub Activity_Create(FirstTime As Boolean)
Sub ThreadStuff
Sub countInTimer_Tick()
My questions are above in red...thanks!
Sub Process_Globals
Dim Thread1 As Thread
Dim Timer1 As Timer
End SubDim Timer1 As Timer
Sub Activity_Create(FirstTime As Boolean)
Thread1.Initialise("Thread1")
Thread1.Start(Null,"ThreadStuff", Null) (1) Can I call it like this (I got some strange errors about missing parameters when I tried this)?
End SubThread1.Start(Null,"ThreadStuff", Null) (1) Can I call it like this (I got some strange errors about missing parameters when I tried this)?
Sub ThreadStuff
Timer1.Initialize("Timer1", 1000)
Timer1.Enabled = True
End SubTimer1.Enabled = True
Sub countInTimer_Tick()
(2) Can I write a Log(DateTime.Now) here (I wasn't sure if the Log is available to the thread...it wouldn't write to the Log when I tried it in a GUI thread)?
End SubMy questions are above in red...thanks!