Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
LoadTrucks
end if
end sub
sub LoadTrucks
Dim job As HttpJob
job.Initialize("LoadTrucks", Me)
job.Download("xxx.asmx/myTruckList")
end sub
Sub JobDone(Job As HttpJob)
If Job.Success Then
Select Job.jobname
Case"LoadTrucks"
HandleTrucks(Job)
end if
Sub HandleTrucks(Job As HttpJob)
If Job.Success = FalseThen
ToastMessageShow("Error downloading trucks.", True)
ProgressDialogHide
Return
EndIf
Dim TextReader1 AsTextReader
TextReader1.Initialize(Job.GetInputStream)
Dim Text As String
Text = TextReader1.ReadAll
DoWhile Text.IndexOf(">")>0
Dim StartTag As Int
Dim EndTag As Int
StartTag=Text.IndexOf("<")
EndTag=Text.IndexOf(">")+1
Dim s AsStringBuilder
s.Initialize
s.Append(Text)
s=s.Remove(StartTag,EndTag)
Text=s.ToString
Loop
TextReader1.Close
Try
Dim p As JSONParser
p.Initialize(Text)
Dim MenuItems AsList
MenuItems =p.NextArray
Dim sTruckNumber AsString
Dim sTruckCode AsString
ProgressDialogShow2("Getting Data From Server...", True)
For i = 0To MenuItems.Size - 1
oRowMap=MenuItems.Get(i)
sTruckNumber=oRowMap.Get("trucknumber")
sTruckCode=oRowMap.Get("truckcode")
oDB.SaveTruckItem(sTruckNumber,sTruckCode)
Next
ProgressDialogHide
Catch
ToastMessageShow("Error Loading Trucks",True)
EndTry
End Sub
The code runs correctly but the progress dialog does not display!