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