Android Question how to set property label.setcoloranimated continuous

Nitin Joshi

Active Member
Licensed User
Hi, I want help to know, how to keep changing color of label using setcoloranimated continuously? As i observed that color animation stops after set interval.


Well-Known Member
Licensed User
Longtime User
Try if this can be useful to You.


  • Label
    9.3 KB · Views: 128
Upvote 0


B4X founder
Staff member
Licensed User
Longtime User
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)
   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)
End Sub

Sub StopColorsAnimations
   ColorsLoopIndex = ColorsLoopIndex + 1
End Sub
Upvote 0