Android Question download images

fanfalveto

Active Member
Licensed User
Longtime User
I see some examples about download images,but in all i have the same problem.
in my code always when try conect to service the log says this
sending message to waiting queue of uninitialized activity (startdownload)
.
but the examples run ok.
i don´t understand why,i reviewed a lot of times both codes and are the same (i think).
any idea please?
thank you
 

fanfalveto

Active Member
Licensed User
Longtime User
now i can conect but only i can see the first image
B4X:
Sub BuildItems
    If links.Size = 0 Then
    Return
    End If
    clv.Clear
    Dim m As Map
    m.Initialize
            For Each link As String In links
            Do While ii<10 Then
            fotoprod.Initialize("fotoprod")
            m.Put(fotoprod, "http://www.loc.gov/rr/print/list/" & link)       
          ImageViews.Add(fotoprod)
            Log("aa "&ImageViews.Size)
            Log(m.Size)   
            clv.Add(CreateListItem("" ,1%x, 1%y), 34%y, i)'llama a meter los productos en el clv
            ii=ii+1
                Loop           
            Next
    CallSubDelayed2(ImageDownloader, "Download", m)
End Sub
and this for put the images into customlistview but only can see the fist image
B4X:
Sub CreateListItem(Text As String, Width As Int, Height As Int) As Panel'aqui va como se meten las cosas en el clv
    If ii=11 Then ii=10
p.Initialize("")'inicia el panel
    p.Color = Colors.Transparent
'here to put images into clv
fotoprod.Initialize("")
fotoprod.SetBackgroundImage(LoadBitmap(File.DirAssets,(ii&".jpg")))
            fotoprod.Gravity=Gravity.FILL
            Log("acccccca "&ImageViews.Size)
            fotoprod= ImageViews.Get(ii-1)
            p.AddView(fotoprod,  2%x,1%y, 40%x,23%y) 'view #1
End Sub
Any idea please?
 
Upvote 0

fanfalveto

Active Member
Licensed User
Longtime User
Sorry i see the problem is in
Sub BuildItems
must be this not the other
B4X:
Sub BuildItems
Dim aa As Int=1
    If links.Size = 0 Then
    Return
    End If
    clv.Clear
    Dim mm As Map
    mm.Initialize
            For Each link As String In links     
            fotoprod.Initialize("fotoprod")      
            mm.Put(fotoprod, "http://www.loc.gov/rr/print/list/" & link)       
          ImageViews.Add(fotoprod)   
            Log("aa "&ImageViews.Size)   
            Log(mm.Size)   
                If aa<11 Then
            clv.Add(CreateListItem("" ,1%x, 1%y), 34%y, i)'llama a meter los productos en el clv
            aa=aa+1
                End If           
            Next
    CallSubDelayed2(ImageDownloader, "Download", mm)
End Sub
.Now runs fine.
Thank you and sorry
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…