I have about 100 lines drawn in a loop ,
I am not sure how to draw this with a timer, because I need the loop
also for other things which have be done.
Now I see all lines , when the last line is drawn, but I want to see each line drawn on the screen.
The UI will not refresh until your sub ends. Klaus' suggestion is correct, create a timer and handle the drawing in the tick event. For example:
B4X:
Sub Process_Globals
Private DrawTimer As Timer
End Sub
Sub Globals
Private LoopCount As Int
End Sub
Sub Activity_Resume
DrawTimer.Initialize("DrawTimer", 2000)
LoopCount = 0
DrawTimer.Enabled = True
End Sub
Sub Activity_Pause
DrawTimer.Enabled = False
End Sub
Private Sub DrawTimer_Tick
If LoopCount > 100 Then
DrawTimer.Enabled = False `
Else
' draw our stuff
LoopCount = LoopCount + 1
End If
End Sub