iOS Question ImageDownloader and CLV

MarcoRome

Expert
Licensed User
Longtime User
Hi All.
I have this code:

B4X:
....
Sub CreateListItem(Text As CSBuilder, name_image As String, Width As Int, Height As Int, riga As Int, parametro As String) As Panel
    Dim p As Panel
    p.Initialize("")
    #if B4A
    p.SetLayout(0, 0, Width, Height)
    #else if B4i
    p.SetLayoutAnimated(0, 1, 0, 0, Width, Height) 'set the size before the layout is loaded
    #End If
    
    p.LoadLayout("lay_list_prenotazioni")
    

    
    lbl_iscritti.AttributedText = Text
    lbl_iscritti.Tag = parametro
    btn_partita_giocata.Tag = parametro
    
    
    'Immagina Carico dal Sito B4A / B4i
    'carica_foto.Initialize
    #if B4i
    carica_foto.Put(img_iscritti, "https://www.xxxx.com/sport/"& name_image)
    'Downloader.Download(carica_foto)
    #End If

    Return p
End Sub
....





Sub JobDone (Job As HttpJob)
   
    Log("JobName = " & Job.JobName & ", Success = " & Job.Success)
    If Job.Success Then
.....
For i = 0 To VERIFICA.Size - 1
                        m = VERIFICA.Get(i)
                       ........
                       clv.Add(CreateListItem( cs, m.Get("foto"), clv.AsView.Width, 200dip, i, ......., 
Next

                    Downloader.Download(carica_foto)

All work, but often the picture arent all displayed, in some cases yes, in other cases not.
This is the correct way to use the Downloader class, or do i make a mistake ?
Thank you
Marco
 
Top