Android Question No ProgressDialogShow

AHilberink

Active Member
Licensed User
Longtime User
Hi,

I want to use ProgressDialogShow during Panel.LoadLayout, but it seems not possible. Do I overlook something or is this a correct behaviour?

The Layout file is big and takes time to load.

B4X:
ProgressDialogShow
pnlWeek.LoadLayout("Week")
ProgressDialogHide

pnlWeek is part of TabStrip.

Best regards,
André
 

DonManfred

Expert
Licensed User
Longtime User
B4X:
ProgressDialogShow
sleep(250)
pnlWeek.LoadLayout("Week") ' It only take milliseconds... Doung a ProgressDialogShow here is a mistake.
ProgressDialogHide
sleep(250)
 
Upvote 0

AHilberink

Active Member
Licensed User
Longtime User
B4X:
ProgressDialogShow
sleep(250)
pnlWeek.LoadLayout("Week") ' It only take milliseconds... Doung a ProgressDialogShow here is a mistake.
ProgressDialogHide
sleep(250)

Hi DonManfred,

I understand your It only take milliseconds... Doung a ProgressDialogShow here is a mistake. If the load takes milliseconds, there is no time to Show, before the Hide is executed. I understand.

My load takes about 10-15 seconds and starts by pressing a button. My users now press twice or more, because it looks nothing happening.
I test with your code and Yes it is showing now, but during the LoadLayout the ProgressDialog is freezing. Strange. Now I have lost of more milliseconds because of the sleep. Anyway, now it works.

Thank you for helping.

Best regards,
André
 
Upvote 0

AHilberink

Active Member
Licensed User
Longtime User
I´m pretty sure it is NOT the LoadLayout which took this time

I test it with this code:
B4X:
Log(DateTime.Time(DateTime.Now))
pnlWeek.LoadLayout("Week")
Log(DateTime.Time(DateTime.Now))

Maybe something to do with my Samsung Tab A?

I discover that a Sleep(15) also does the job, so thanks again for your help.
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
Maybe one of these two methods might work:

B4X:
Sub Activity_Resume

   ProgressDialogHide

End Sub

or this...
B4X:
Sub Activity_Create(FirstTime As Boolean)

   .... (your code)
   .... (your code)

   CallSubDelayed(Me,"HideProgress")   'place this as last line in Activity_Create

Call Sub

Sub HideProgress()

   ProgressDialogHide

End Sub
 
Upvote 0
Top