iOS Question B4i how to add a timer in app code

cambol

Member
Licensed User
Dear

I want to add a timer .
In B4A ,I can use Timer and Sender and library Reflection .

But , How to do in B4i
 

BillMeyer

Well-Known Member
Licensed User
The same code should work in B4i.
Exactly !!

Try this (courtesy of @Peter Simpson )

B4X:
Sub Process_Globals
    Private FlashTimer As Timer
    Private FlashOn As Boolean = False
End Sub

Sub Activity_Create(FirstTime As Boolean)
    FlashTimer.Initialize("FlashTimer", 1)
    FlashTimer.Enabled = True
End Sub

Sub FlashTimer_Tick
    FlashTimer.Interval = 250

    If FlashOn = False Then
        FlashOn = True
        Log("Switch-on the flash")
    Else
        FlashOn = False
        Log("Switch-off the flash")
    End If
End Sub
 
Top