ProgressDialog not spinning

Big JR

Member
Licensed User
Longtime User
In Activity_Create I have this code:

ProgressDialogShow("Loading...")
DoEvents
DoEvents
Activity.LoadLayout("main")
ProgressDialogHide

The layout as quite a few panels and views and takes a few seconds to load, hence the need for the progress dialog.

The progress dialog doesn't spin, presumably because until LoadLayout is finished it isn't getting updated.

How can I get the progress dialog to spin while the layout is loading? Or does it need to have a DoEvents incorporated into the LoadLayout routine?
 

pluton

Active Member
Licensed User
Longtime User
It is late here in Croatia but why don't you try replace some function.
For example

B4X:
Activity.LoadLayout("main")
ProgressDialogShow("Loading...")
DoEvents
DoEvents
ProgressDialogHide
 
Upvote 0

Big JR

Member
Licensed User
Longtime User
The second code won't do what is intended. It is intended that the progress dialog shows while the layout is loading so it has to start before loadLayout. There's no point in a progress dialog that just flashes up after the layout has loaded.
 
Upvote 0

vb1992

Well-Known Member
Licensed User
Longtime User
What if you put it in.....


B4X:
Sub globals
  ProgressDialogShow("Loading...")
and the first line in Activity.

B4X:
Sub Activity_Create(FirstTime As Boolean)
   
   Activity.Invalidate


Does that help?
 
Upvote 0

Big JR

Member
Licensed User
Longtime User
Thanks Erel. I've split the layout into separates, one for each panel with DoEvents in between each load.
 
Upvote 0
Top