Android Question Why isn't ProgressDialogShow2 displaying

davepamn

Active Member
Licensed User
Longtime User
In the Activity Create when firstime =true I load my sqlite database with data from the server.

in the httpjob handler I call

ProgressDialogShow2("Getting data from server", true")

It does not display. Once the activity has been loaded if I make a call to the server, the dialog appears. What is happening?
 
Last edited:

davepamn

Active Member
Licensed User
Longtime User
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!
 
Upvote 0

Steini1980

Active Member
Licensed User
Longtime User
May be the For-Loop runs to short to view the Progressdialog?
Try to set the Progressdialog at begin of the function or activity?
 
Upvote 0

davepamn

Active Member
Licensed User
Longtime User
There may be another concurrent job that is hiding the dialog. I have three jobs that run concurrently.
 
Upvote 0

davepamn

Active Member
Licensed User
Longtime User
I found the problem

I have a timer1 thread that sends data to the server for records that have not transact if after the wifi connection is restored. It was hiding the dialog

ProgressDialogShow2 is working as expected. Thanks
 
Upvote 0
Top