Android Question No ProgressDialogShow

AHilberink

Active Member
Licensed 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é
 

AHilberink

Active Member
Licensed 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é
 

AHilberink

Active Member
Licensed 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.
 

JohnC

Well-Known Member
Licensed 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
 
Top