Android Question Bitmapasync library

saeed10051

Active Member
Licensed User
Longtime User
Ref. following thread

i am trying to implement the imageloader in my project so that i can load images faster from online folder
i am using following code, but the images load at the rate of 1 image per second. Although i have reduced the individual image size to 200kb and there are only 5 images. Can someone guide me where i need to make change in my code to implement bitmapasync
B4X:
Sub loadlistview
    Dim Table As List
    Dim p As JSONParser
    Dim res As String
    Dim j As HttpJob
    Dim m1 As Map
    j.Initialize("", Me)
    j.Download("http://saeedhassan.atwebpages.com/con.php")
    Wait For (j) jobdone (j As HttpJob)
    If j.Success Then
        res = j.GetString
        Log(res)
        p.Initialize(res)
        Table = p.NextArray
        For i = 0 To Table.Size-1
            m1 = Table.Get(i)
            j.Download("http://saeedhassan.atwebpages.com/images/"&m1.Get("contactname")&".jpg")
            Wait For (j) jobdone (j As HttpJob)
            If j.Success Then
                'Wait For (ImageLoader.LoadFromHttpJob(j, 500dip, 500dip)) Complete (bmp As B4XBitmap)
                B1 = j.GetBitmap
            End If
            clv2.Add(CreateListItem(m1.Get("contactname"), m1.Get("areacode")&m1.Get("phonenumber"),clv2.AsView.Width, 80dip), m1.Get("contactname"))
            
        Next
    End If
    
    
End Sub
Sub CreateListItem(Text1 As String,Text2 As String, Width As Int, Height As Int) As Panel
    Dim p As B4XView = xui.CreatePanel("")
    p.SetLayoutAnimated(0, 0, 0, Width, Height)
    p.LoadLayout("CellItem")
    Label1.Text = Text1
    label2.Text = Text2
   
    ImageView1.Bitmap = B1
    
    Return p
End Sub
 
Top