I post this for the common good. I solved the problem with a work-around, but I need to know why the following does not work.
The order in which I call WaitFor subs should not matter? This is a trimmed-down version of a large project.
The order in which I call WaitFor subs should not matter? This is a trimmed-down version of a large project.
B4X:
Sub Process_Globals
Private xui As XUI
End Sub
Sub Globals
Private GLS1 As glSurfaceView
Private Facelist As List
Private mbm(6) As Bitmap
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout")
' The following two lines in this order WORK
Wait For(DisplaySplash) complete (Result As Int)
Wait For (GetConfigFile) complete (Result As Int)
' The following two lines in this order DOES NOT WORK
''Wait For (GetConfigFile) complete (Result As Int)
''Wait For(DisplaySplash) complete (Result As Int)
End Sub
Private Sub GetConfigFile As ResumableSub
Log("GetConfigFile")
Return 0
End Sub
Private Sub DisplaySplash As ResumableSub
Log("DisplaySplash")
Facelist.Initialize
'add 6 images to (List) facelist - one for each of the faces of the cube
mbm(0).Initialize(File.DirAssets,"rcYellow.png")
Facelist.Add(mbm(0))
mbm(1).Initialize(File.DirAssets,"rcRed.png")
Facelist.Add(mbm(1))
mbm(2).Initialize(File.DirAssets,"rcBlue.png")
Facelist.Add(mbm(2))
mbm(3).Initialize(File.DirAssets,"rcGreen.png")
Facelist.Add(mbm(3))
mbm(4).Initialize(File.DirAssets,"rcWhite.png")
Facelist.Add(mbm(4))
mbm(5).Initialize(File.DirAssets,"rcOrange.png")
Facelist.Add(mbm(5))
GLS1.Color = Colors.Transparent ' does not work
'pass (List) facelist on to the wrapper
GLS1.SixFaces = Facelist
'this has to be set AFTER the LIST has been passed to the wrapper
GLS1.ZoomInOut = True 'it will make the cube zoom In/Out while spinning anround the below defined RotationPlane
'GLS1.CubeSpeed = 3.0 'A negative value will reverse the direction of the spin
GLS1.CubeSpeed = 1.0 'A negative value will reverse the direction of the spin
GLS1.RotationPlane(1.0, -1.0, 0.0) 'Keep these values between 0.0 and 1.0 (you can also apply negative values)
Return 0
End Sub