Android Question B4XPages Splash

luke2012

Well-Known Member
Licensed User
Longtime User
Hi all,
I'm testing a very cool (and very useful) tutorial named "B4XPages Splash Screen" by @Erel

POSSIBLE BUG ?
If I install and run it as it is (without changes) I see the splash with the B4X logo.
After the logo disappear I see a white empty screen with a text on top that says "MainPage". If I check the "B4XMainPage" code I see:

B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Wait For (ShowSplashScreen) Complete (Unused As Boolean)
    Root.LoadLayout("MainPage")
    'don't use %y in your code! Use Root.Height instead.
End Sub

The problem is that Root.LoadLayout("MainPage") should load the "MainPage.bal" layout file that contains a panel, a button and a label. Instead I see a white empty screen.

AFTER MY CODE CHANGE...
B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    'Wait For (ShowSplashScreen) Complete (Unused As Boolean)
    Root.LoadLayout("MainPage")
    'don't use %y in your code! Use Root.Height instead.
End Sub

If I comment the "Wait For (ShowSplashScreen)..." all work as expected. The MainPage.bal is loaded. and I can see the grey Button with "Click" text and the belove label text.
So the solution is to disable (comment) the code belove ?

B4X:
Wait For (ShowSplashScreen) Complete (Unused As Boolean)

P.S.
Another thing: how to support also animated images instead of static logo ?

Thanks in advance for your help!
Luca.
 

udg

Expert
Licensed User
Longtime User
@Erel: it seems you forgot to publish the updated code :)
 
Upvote 0

luke2012

Well-Known Member
Licensed User
Longtime User
Use B4XGifView or APNG.

There was indeed a bug. It is fixed: https://www.b4x.com/android/forum/threads/b4x-b4xpages-splash-screen.120851/

Thank you Erel! I applied the fix.
One more thing :)
Running the app on Android, now between the splash screen (with logo) and the layout loaded (see my code within B4XMainPage) I see an empty white screen named "MainPage" that appears. Is it possible (somewhere within the splash code) to hide it?

B4X:
Private Sub B4XPage_Created (Root1 As B4XView)    
    'B4XPages
    Root = Root1
    Wait For (ShowSplashScreen) Complete (Unused As Boolean)
    Root.LoadLayout("home")
end sub
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
About " Use B4XGifView": So it could be integrated within the B4XPages Splash screen project without problems ?
Yes.

Running the app on Android, now between the splash screen (with logo) and the layout loaded (see my code within B4XMainPage) I see an empty white screen named "MainPage" that appears. Is it possible (somewhere within the splash code) to hide it?
There is a delicate issue here and your device behaves different than most devices, so you need to wait the full 500ms until the layout is loaded.
You can improve the situation by loading something before the Wait For. Just remember that the layout height might not be accurate at this point. You can for example keep the splash screen background color and remove it after the Wait For line.
 
Upvote 0
Top