Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
Dim Register As HttpJob
Register.Initialize("rest", Me)
Register.Tag = "resttest.json"
Register.Download("http://resttst.yaskawa.com.br:9090/rest/sample")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub JobDone(Job As HttpJob)
ProgressDialogHide
If Job.Success Then
If Job.JobName = "rest" Then
'Dim out As OutputStream
'out = File.OpenOutput(File.DirRootExternal,Job.Tag,False )
'File.Copy2(Job.GetInputStream, out)
'out.Close
Log($"The job resttest finished "$)
ParseJSON(Job.GetString)
End If
Else
Log( Job.ErrorMessage)
End If
Job.Release
End Sub
Sub ParseJSON(jsonstring As String)
Dim parser As JSONParser
parser.Initialize(jsonstring)
Dim root As List = parser.NextArray
For Each colroot As Map In root
Dim name As String = colroot.Get("name")
Dim id As Int = colroot.Get("id")
Log($"${name} - ${id}"$)
Next
End Sub