Android Question Timers should be declared in Process_Globals

LucaMs

Expert
Licensed User
Longtime User
Can an empty process globals array of Timers be used and add new timers to it this way?

B4X:
Sub Process_Globals
    Privare arrTimers(20) As Timer
End Sub

Public Sub AddTimer(EventName As String, Interval As Int)
    Dim tmr As Timer
    tmr.Initialize("tmr", Interval)
    arrTimers(n) = tmr
End Sub
(In the example I don't use EventName; I would use it "later". Also "n"... just an example)

A private object (tmr in AddTimer) added to a global array, uhm... thinking...
ArrTimers will store references to timer objects, which are initiliazed as private.
Well, I don't know; this is the reason for this question :p

Also, I would prefer to use a Map to store the timers, but this could be even worse, I think.
 
Top