What you mean exactly?
I know you know how to make activity as splash screen with timer to close it and show next app entry,
Or did you mean activity as splash appear before B4XPage appears?
Actually indeed this is an issue: yes, Main activity may be used as a splash screen, and after time is out - Main starts Second activity and makes Self.Finish.
But next it's impossible to make the full exit in the Second activity - the Main is re-started again at any try to make Finish or ExitApplication, as it was the previous one.
Strange.
1) When I created this attached small example - all works fully OK !
2) But when i make this way my real (big) project with the same 2 activities, but AppCompatActivity compatible with a ACToolBarLight - it works wrong, the Main is re-started at exit.
Activity Lifecycle it's the worst thing Android has (now we have B4XPages that help a lot).
I would not get crazy using an Activity just to show a SplashScreen, considering that you can simply do it with a Panel in a single activity.
Or maybe I am missing something?
Also not - there are lots of modules and objects must be initialized during Activity start, and also _Resume event is going ASAP after Activity_Create, and makes errors if something is not initialized on time at _Create...
And this is the big reason we shifted toward B4XPages methodology in new projects, but our old big projects without B4XPages are having this problem and not solved yet, we can't convert them to B4XPages type, many of them working on it for a years!
We need an excellent approach for your question solution.
I don't understand why exitapplication function does not work as its name!
Include a Panel as Splash Screen with high Elevation in your layout and set it Not Visible in Designer.
Then in your code
B4X:
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout")
If FirstTime Then
ShowSplash
End If
'Here everything goes on.......
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
private Sub ShowSplash
SplashPanel.Visible = True
Sleep(4000)
SplashPanel.Visible = False
End Sub
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.