Try
'Gets all the available screws
ExecuteRemoteQuery("SELECT kategorie, id FROM screwtable ORDER BY id", SCREW_LIST)
Catch As Exception
ToastMessageShow("Internet needed", True)
End Try
Sub ExecuteRemoteQuery(Query As String, JobName As String)
Dim job As HttpJob
job.Initialize(JobName, Me)
job.PostString("http://www.xxx.xx/m/db/screws.php", Query)
End Sub
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 SCREW_LIST
Dim SCREWNAMES As List
SCREWNAMES= parser.NextArray 'returns a list with maps
For i = 0 To SCREWNAMES.Size - 1
Dim m As Map
Dim mm As Map
m = SCREWNAMES.Get(i)
mm = SCREWNAMES.Get(i)
Dim tl As TwoLines
tl.First = m.Get("kategorie")
sm.AddItem(tl.first, LoadBitmap(File.DirAssets, "book_open.png"), tl.First)
tl.Second = m.Get("name")
clv3.Add(CreateListItem(tl.Second, clv3.AsView.Width, 50dip), 50dip, tl)
Next
...
etc.