B4J Question [B4X] CustomListView and Splash Screen

CryoGenID

Active Member
Licensed User
Longtime User
Hello dear devs,

I am currently trying to get this done:
I want to create a sub which creates a splash screen, regardless what is currently on the screen for B4X.
My main problem is:
How do I do this? ;-)
Reading the forum and trying out a lot of my ideas didn't really solve my problem...
My currenty idea was to backup the CLV to a variable, then clear the CLV and replace it with my splash screen and then copy the backup back over the CLV.
But the problem is that the screen stays empty, so I think I would need to "refresh" somehow the CLV as I have overwritten it "hardcore"?

Or do you have any other ideas, e.g. programmatically addinga layout over the current screen and then removing it again (so basically "hiding" the normal UI and all its contents with the temporary layout or so?

I would be happy about any ideas you have and which work with B4X (--> B4J/B4i and B4A)...

Thanks and best regards,

Chris
 
Solution
I want to create a sub which creates a splash screen, regardless what is currently on the screen for B4X.
It is sufficient to create a layout that contains a full screen panel (on which to put an ImageView or other) of which you set the Elevation value high (20dip should suffice).

Then:
B4X:
Root.LoadLayout("laySplash")
Root.LoadLayout("layWhatYouWant")
Sleep(1500)
pnlSplash.RemoveView

LucaMs

Expert
Licensed User
Longtime User
I want to create a sub which creates a splash screen, regardless what is currently on the screen for B4X.
It is sufficient to create a layout that contains a full screen panel (on which to put an ImageView or other) of which you set the Elevation value high (20dip should suffice).

Then:
B4X:
Root.LoadLayout("laySplash")
Root.LoadLayout("layWhatYouWant")
Sleep(1500)
pnlSplash.RemoveView
 
Upvote 0
Solution

CryoGenID

Active Member
Licensed User
Longtime User
Thanks MucaMS,

sometimes things are so easy... I was thinking way too complicated :)

THANKS :)

Best regards,

Chris
 
Upvote 0

CryoGenID

Active Member
Licensed User
Longtime User
Well I have a problem:
Sometimes the "removeView" leaves the elements in the CustomListView that were behind it invisible... So I only have a white "box" where the splash screen pane was...
Do I need to "refresh" the view somehow?

Thanks :)

Best regards,

Chris
 
Upvote 0

AnandGupta

Expert
Licensed User
Longtime User
Well I have a problem:
Sometimes the "removeView" leaves the elements in the CustomListView that were behind it invisible... So I only have a white "box" where the splash screen pane was...
Do I need to "refresh" the view somehow?

Thanks :)

Best regards,

Chris
Change Lucas code to this
B4X:
       Root.LoadLayout("laySplash")
Sleep(1500)
pnlSplash.RemoveView
Root.LoadLayout("layWhatYouWant")

I use this way.
 
Upvote 0

CryoGenID

Active Member
Licensed User
Longtime User
Thanks Anand!

Unfortunately I do a lot of dynamic changes to a layout when I load it, so it this is the only option then I would have to change my whole app logic to re-init all the views (which will slow the app down :-( )

Is there no way to (re-)display the content which was hidden by the panel which I loaded as a splash screen?

Thanks :)
 
Upvote 0

AnandGupta

Expert
Licensed User
Longtime User
Thanks Anand!

Unfortunately I do a lot of dynamic changes to a layout when I load it, so it this is the only option then I would have to change my whole app logic to re-init all the views (which will slow the app down :-( )

Is there no way to (re-)display the content which was hidden by the panel which I loaded as a splash screen?

Thanks :)
Yes there is. B4XPages.
Keep in mind B4XPages are just panels with power of class methods.

Create all your dynamic layouts in pages, remove animation, show them as required, splash, view, splash view etc.
 
Upvote 0

CryoGenID

Active Member
Licensed User
Longtime User
Thanks for your reply! :)
I am already using them.. I think... (but not to their full potential as it seems?) ...

I followed the tutorial PDF from Klaus and Erel and am working currently with the "B4XMainPage", load the views into a CustomListView there and always exchange the content of the CustomListView... So also the Splash "Screen" is inside an already loaded CLV... But when I delete this panel-view from the populated CLV, the area stays white :-(

Your proposal would be to create a new B4XPage (being the Splash Screen) and then jump back and forth between the zwo B4XPages as I need it?
Now I just have to figure out how to jump between B4XPages (in B4X) ;-)

Or you do know of a demo source code somewhere by chance?

Thanks and best regards,

Chris
 
Upvote 0

AnandGupta

Expert
Licensed User
Longtime User
Now I just have to figure out how to jump between B4XPages (in B4X) ;-)
Erel's demos are the best.
Still you can use below call for it
B4X:
B4XPages.ShowPage("Splash")
B4XPages.ShowPageAndRemovePreviousPages("ViewPage")
B4XPages.ShowPageAndRemovePreviousPages("Splash")
B4XPages.ShowPageAndRemovePreviousPages("ViewPage2")
Assuming you are not using B4XPages for page1->page2->page3 and back, logic
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
Well I have a problem:
Sometimes the "removeView" leaves the elements in the CustomListView that were behind it invisible... So I only have a white "box" where the splash screen pane was...
Do I need to "refresh" the view somehow?

Thanks :)

Best regards,

Chris
Make sure the layout-splash-screen is based on a panel (give it the name pnlSplash) and set its elevation to 100dip.
If you then execute that lines in that order, it is not possible that writing; pnlSplash.RemoveView is not removed.

Post the problematic part, if you can/want.
 
Upvote 0

JGParamo

Active Member
Licensed User
I want to create a sub which creates a splash screen, regardless what is currently on the screen for B4X.
My main problem is:
How do I do this? ;-)
I have made some sub that implement a sort of splash screen. You may find it in the Main code module and other B4XPage class modules in the Project.zip file in the previous thread I have posted in this forum (https://www.b4x.com/android/forum/t...page-out-of-multiple-pages.139658/post-884850). Look for the OneDrive link named Project.zip I have provided. It uses jFX which seems to work for B4J only. Hoped you may find something useful for your desired splash screen.
 
Last edited:
Upvote 0
Top