Sub fill_clv (rs As ResultSet) As ResumableSub
    xclv.Clear
    Dim mapColors As Map
    mapColors.Initialize
    mapColors.Put(0, Colors.White)
    mapColors.Put(1, Colors.RGB(205,127,50))
    mapColors.Put(2, Colors.RGB(192,192,192))
    mapColors.Put(3, Colors.RGB(252,194,0))
    Dim ColorIndex As Int
   
    Dim Height As Int = xclv.AsView.Width / 6
   
    Dim Count As Int
   
    Do While rs.NextRow
        If Count Mod 10 = 0 Then
            Sleep(0) 'Questo Sleep serve per evitare che l'animazione del Loading Indicator si blocchi
        End If
        Count = Count + 1
       
        Dim p As B4XView = xui.CreatePanel("")
        p.SetLayoutAnimated(0,0,0,xclv.AsView.Width, Height)    'Il tuo layout ha una misura precisa e si vedeva che l'altezza era 1/6
                                                                            'della larghezza. Quindi puoi definire subito la misura del panel
                                                                            'per evitare il warning del Panel Size Unknown
        p.LoadLayout("playerDb")
       
       
        lblName.Text = rs.GetString("PlayerName")
        lblPos1.Text = rs.GetString("Pos1")
        lblPos2.Text = rs.GetString("Pos2")
        If lblPos2.Text = "null" Then
            lblPos2.Text = ""
        End If
        lblTeam.Text = rs.GetString("Team")
        lblGen.Text = rs.GetInt("GEN")
        Dim gen As Int = rs.GetInt("GEN")
'        If gen >0 And gen <10 Then
'            lblGen.Color = Colors.White
'        Else if gen >9 And gen <20 Then
'            lblGen.Color = Colors.RGB(205,127,50)
'        Else if gen >19 And gen <30 Then
'            lblGen.Color = Colors.RGB(192,192,192)
'        Else if gen >29 And gen <40 Then
'            lblGen.Color = Colors.RGB(252,194,0)
'        Else
'            lblGen.Color = Colors.Red
'        End If
        ColorIndex = gen / 10
        If ColorIndex < 4 Then
            lblGen.Color = mapColors.Get(ColorIndex)
        Else
            lblGen.Color = Colors.Red
        End If
       
        xclv.Add(p, rs.GetString("ID"))
    Loop
   
    rs.Close
   
    Return True
End Sub