Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Private ListView1 As ListView
Private cnt As Int
Private value As Int
Private label1 As Label
Private label2 As Label
Private colore As String
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("Layout1")
label1 = ListView1.TwoLinesLayout.Label
label2 = ListView1.TwoLinesLayout.SecondLabel
For cnt = 0 To 20
value = Rnd(1,50)
Select True
Case value < 0
label1.TextColor = Colors.Magenta
label2.TextColor = Colors.Magenta
colore = "magenta"
Case value >= 0 And value < 6
label1.TextColor = Colors.Green
label2.TextColor = Colors.Green
colore = "verde"
Case value > 5 And value < 16
label1.TextColor = Colors.Yellow
label2.TextColor = Colors.Yellow
colore = "giallo"
Case value > 15 And value < 31
label1.TextColor = Colors.RGB(0xFF, 0x8C, 0x00)
label2.TextColor = Colors.RGB(0xFF, 0x8C, 0x00)
colore = "arancione"
Case value > 30
label1.TextColor = Colors.Red
label2.TextColor = Colors.Red
colore = "rosso"
End Select
Sleep(0) ' Se lo tolgo diventa un solo colore
ListView1.AddTwoLines(value, colore)
Next
End Sub