Wait Pause code

aaronk

Well-Known Member
Licensed User
Longtime User
Hello,

Use a Timer to do this.

B4X:
Sub Process_Globals
    Dim Timer1 As Timer
End sub

Sub Activity_Create(FirstTime As Boolean)
    ' in 5 seconds time it will run the code in Timer1
    Timer1.Initialize ("Timer1", 5000)
    Timer1.Enabled = True
End Sub

Sub Timer1_tick
    ' Now continue to another sub...
    'Or
    ' Place your code here
End Sub

Or, I have found this code but using a DoWhile may crash the app after time

B4X:
Sub Wait(Sekunden As Int)
   Dim Ti As Long
   Ti = DateTime.Now + (Sekunden * 1000)
   Do While DateTime.Now < Ti
      DoEvents
   Loop
End Sub

by calling: Wait ( seconds )
 
Upvote 0
Top