Android Question Re-initialize timers question

davemorris

Active Member
Licensed User
Longtime User
Hi, Guys
Can someone clarify if it is OK to re-initializer a timer several times within the same activity i.e.

B4X:
TimerName.initialize(....)

Sorry about the basic question, but I am sure I read somewhere on forum or in the documentation (an now can't find it) that timers should only be initialized once.

Regards
Dave
 

LucaMs

Expert
Licensed User
Longtime User
Hi, Guys
Can someone clarify if it is OK to re-initializer a timer several times within the same activity i.e.

B4X:
TimerName.initialize(....)

Sorry about the basic question, but I am sure I read somewhere on forum or in the documentation (an now can't find it) that timers should only be initialized once.

Regards
Dave
I don't think it could be a problem but... why do it? Just stop it (set Enabled to False) and maybe change the Interval property.
 
Last edited:
Upvote 0

wes58

Active Member
Licensed User
Longtime User
Hi, Guys
Can someone clarify if it is OK to re-initializer a timer several times within the same activity i.e.

B4X:
TimerName.initialize(....)

Sorry about the basic question, but I am sure I read somewhere on forum or in the documentation (an now can't find it) that timers should only be initialized once.

Regards
Dave
The only reason I see of doing it, is if you are using it in different parts of your code and you are not sure whether the timer has been initialised before. So then you check whether it has been initialised and if not initialise it:
B4X:
    If Not(TimerName.IsInitialized) Then
        TimerName.Initialize(....)
    End If
 
Upvote 0
Top