Hi.
Loading a splash screen with Sleep(0) will not function or display the image at Activity_Create event properly. Adding Doevents 3 times does the trick.
Loading a splash screen with Sleep(0) will not function or display the image at Activity_Create event properly. Adding Doevents 3 times does the trick.
B4X:
Sub Activity_Create(FirstTime As Boolean)
LoadSplashScreen
Doevents: Doevents:Doevents 'Will Display the image successfully with image visibility removed in Activity_Resume Event
'Sleep(0): Sleep(0): Sleep(0) 'Will not display the Image
'Sleep(1) 'Will display the image successfully but visibility will remain
'Sleep(x) 'Will not display the Image. x = any number other then 1
'My app have codes below that takes few seconds to load
End sub
B4X:
Sub Activity_Resume
If imvSplash.IsInitialized Then imvSplash.Visible = False
End sub
B4X:
Sub LoadSplashScreen
imvSplash.Initialize("")
Activity.AddView(imvSplash, 0, 0, 250dip, 50dip)
imvSplash.Left = (Activity.Width - imvSplash.Width) /2
imvSplash.Top = (Activity.Height - imvSplash.Height) /2
imvSplash.Gravity = Gravity.FILL
imvSplash.Bitmap = LoadBitmap(File.DirAssets, "CarGaugeSplash2.png")
imvSplash.Visible = True
End sub