Sub Process_Globals
Private ColorsLoopIndex As Int
Private xui As XUI
End Sub
Sub Globals
Private Label1 As B4XView
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("1")
ChangeColorContinuously(Label1, Array As Int(xui.Color_Red, xui.Color_Green, xui.Color_Blue), 1000)
End Sub
Sub ChangeColorContinuously (v As B4XView, Clrs() As Int, Duration As Int)
Dim MyIndex As Int = ColorsLoopIndex
Dim i As Int
Do While MyIndex = ColorsLoopIndex
Dim FirstColor As Int = Clrs(i)
i = (i + 1) Mod Clrs.Length
Dim SecondColor As Int = Clrs(i)
v.SetColorAnimated(Duration, FirstColor, SecondColor)
Sleep(Duration)
Loop
End Sub
Sub StopColorsAnimations
ColorsLoopIndex = ColorsLoopIndex + 1
End Sub