Android Question B4J Server returning a list

Tadeu Botelho

Member
Licensed User
Longtime User
I need to return a list containing data from a table:
ID, Name, Age, Email
With their respective data.

This list should be sent to the B4J application that will be loading its data into a TableViewer.


'// B4J Server:
B4X:
Sub Handle(req As ServletRequest, resp As ServletResponse)
 
 '// I could not find an example containing a return type like this:
 Dim resp As Map = DBUtils.ExecuteMap(Main.SQL, "SELECT * FROM Pessoas ORDER BY Data DESC")
 resp.ContentType = "Map" '// Map ?
 resp.Write(resp)
 
End Sub


'// B4J Client:
B4X:
Sub Process_Globals
 
 Private fx    As JFX
 Private MainForm   As Form
 Private TableView      As TableView
 Private MsgBox    As Msgboxes
 Private raf    As RandomAccessFile
 Private link  As String
 
End Sub
Sub AppStart (Form1 As Form, Args() As String)
 
 MainForm = Form1
 MainForm.Show
 raf.Initialize(File.DirTemp, "temp", False)
 MainForm.Title = "Server Map ---> Client TableViewer"
 
End Sub
Sub btnDadosExibirNoWebView_Action
 link = "http://localhost:51042" 
 Dim j As HttpJob
 j.Initialize("report", Me) 
 j.Download(link & "/Relatorio")
 pi1.Visible = True
 
End Sub
Sub JobDone(j As HttpJob) 
 
 If j.Success Then
  If j.JobName = "report" Then
   
   '// I could not find an example of a receipt type like this:
   TableView.Items.AddAll(Array As String(  j.GetString2("  Map????  ")  ))
  End if
 End if
End Sub


If anyone can send me an example I will be very grateful.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…