Sub JobDone(job As HttpJob)
ProgressDialogHide
If job.Success Then
Dim res As String
res = job.GetString
Log("Response from server: " & res)
Dim parser As JSONParser
parser.Initialize(res)
Select job.JobName
Case "Job1"
Dim COUNTRIES As List
COUNTRIES = parser.NextArray 'returns a list with maps
clv3.Initialize(Me, "clv3")
Activity.AddView(clv3.AsView, 0, 0, 100%x, 100%y)
For i = 0 To COUNTRIES.Size - 1
Dim m As Map
m = COUNTRIES.Get(i)
'We are using a custom type named TwoLines (declared in Sub Globals).
'It allows us to later get the two values when the user presses on an item.
Dim tl As TwoLines
tl.First = m.Get("titel")
tl.Second = m.Get("darsteller")
tl.Third = m.Get("genre")
tl.Lid = m.Get("id")
Dim Cover As String
Dim b As Bitmap
b.InitializeMutable(200, 200)
Dim c As Canvas
c.Initialize2(b)
c.DrawCircle(100, 100, 50, Colors.Red, True, 0)
Log(res2)
'save image to file
Dim out As OutputStream
out = File.OpenOutput(File.DirDefaultExternal, tl.Lid&".jpg", False)
b.WriteToStream(out, 100, "JPEG")
out.Close
'clv1.AddTextItem("Titel #" & tl.First & CRLF & "Darsteller #" & tl.Second & CRLF & "Genre # "& tl.Third, tl.Lid)
clv3.Add(CreateListItem("Titel : " & tl.First & CRLF & CRLF & "Darsteller : " & tl.Second & CRLF & CRLF & "Genre : "& tl.Third , clv3.AsView.Width, 150dip , tl.Lid), 150dip, "Item #" & i)
'clv3.Add(CreateListItem( , clv3.AsView.Width, 150dip , "http://www.up2city.de/kino/media/103674468/filmplakat_103674468.jpg"), 150dip, "Item #" & i)
Next
End Select
End If
job.Release
End Sub