I was changed Listview_click with button1_click and define dim....
No error but data can't show in listview, what's wrong with my code ??
Sub Button1_Click
'Dim m As Map
Dim data As List
Dim t As String ="koneksi"
data.Initialize
db.QueryASync("select * from "&t&";",t)
For i=0 To data.Size-1
Dim cur As Map = data.Get(i)
lv2.AddTwoLines(cur.Get("PC")&CRLF&cur.Get("NAMAROOM"),cur.Get("STATUSK")&CRLF&cur.Get("NAMA"))
Next
Sub MySQL_QueryResult(data As List, meta As Map)
For i=0 To data.Size-1
Dim cur As Map = data.Get(i)
lv2.AddTwoLines(cur.Get("PC")&CRLF&cur.Get("NAMAROOM"),cur.Get("STATUSK")&CRLF&cur.Get("NAMA"))
Next
End Sub
Query and QueryAsync are two different types. The later is the correct use. I removed Query from the old library. Query blocks the mainthread.
If you device has slow connection and fetching a lot of data. Android may decide to kill your app.
In production Android may decide to block your app in Appstore. Be careful.
Starting two queries. In the result sub for the first you fill listbox1, in result for the second you fill Listbox2
Use the task parameter to distinguish different queries in the resultsub.
How to get result from QueryResult2 ??? I have error to get it...
B4X:
Sub MySQL_QueryResult(data As List, meta As Map)
Dim m As Map = meta
lvlagu.Clear
For i=0 To data.Size-1
If m.Get("TaskID") = "datautm" Then
Dim cur As Map = data.Get(i)
lvlagu.AddTwoLines(cur.Get("JDL_LAGU")&" - "&cur.Get("PENYANYI"),cur.Get("SPATH"))
End If
End Sub
Sub MySQL_QueryResult2(data As List, meta As Map)
Dim m As Map = meta
lvlist.Clear
For i=0 To data.Size-1
Log(data.Get(i))
If m.Get("TaskID") = "pc4" Then
Dim cur As Map = data.Get(i)
lvlist.AddTwoLines(cur.Get("JDL_LAGU"),cur.Get("PENYANYI"))
End If
Next
End Sub