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
I created a small project and seems to be working ok. No need to upload. However, my project using sleep(5000) works but i prefer the doevents to avoid the 5 seconds delay.
In my Splashscreen that works with "sleep(0) instead of Doevents,
but what does not work is myprogressdialog in the zip event.
How would it look like it works without DoEvents?
B4X:
myProgressDialog.Initialize(Activity, 90%x, -1, 10%y, "","", Colors.DarkGray, 0, "Progress",False)
Arc.ZipFolder(File.DirDefaultExternal,File.DirRootExternal&"/"&mailbackuppath,datei,"zippen") 'Alle Daten zippen
myProgressDialog.Hide
Sub zippen_ZipProgression(count As Int,filename As String)
myProgressDialog.ShowProgress("Daten werden gepackt ..."&count&" %", Colors.White, count)
DoEvents
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("main")
pnlSelect.Visible=False
pnlSplash.Visible=True
timer1.Initialize("Timer1", 15000)
timer1.Enabled=True
And check it for a button press here.
B4X:
Sub btnEvent_Click
Dim send As Button
send = Sender
Select send.Tag
Case "BS"
If lblCode.text.Length >0 Then
lblCode.text = lblCode.text.substring2(0,lblCode.Text.length - 1)
End If
Case "lookup"
If lblCode.Text.Length >0 Then
Error_Code = lblCode.Text
SQLTableRead
lblResult.Visible = True
lblCode.Text = ""
Else
lblResult.text = "Please enter error code and dispenser type."
lblResult.Visible = True
End If
Case "I AGREE"
pnlSplash.Visible=False
timer1.Enabled = False
If they don't click the AGREE button within a certain time then the timer will close it.
B4X:
Sub Timer1_tick
pnlSplash.Visible=False
timer1.Enabled = False
CheckUpdate
End Sub