Android Question B4XPages - back icon management

luke2012

Well-Known Member
Licensed User
Longtime User
Hi all,
I'm implementing an app that is based on B4XPages by @Erel (https://www.b4x.com/android/forum/t...k-for-managing-multiple-pages.118901/#content).

I use the MainPage to handle an animated splash based on B4XGifView (see relevant code below).
When the timer is done then I show the home page (the first B4XPage after the MainPage).

B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
    B4XPages.GetManager.TransitionAnimationDuration = 0
    Root = Root1
    Root.LoadLayout("splash")
    '...........
End Sub

Private Sub tmrSplashAnim_Tick
    tmrSplashAnim.Enabled = False
    pnSplashAnim.Visible = False

    B4XPages.ShowPage("AppHome")
End Sub

The problem is about app navigation. When the user touch the back icon the app show the (empty) MainPage and the user lose the app navigation and gets trapped within the MainPage, see the below screens:

b4xpages_back.png
Schermata 2021-01-20 alle 18.36.25.png


@LucaMs suggest me a workaround (to put inside the B4XPage "Home") in order to avoid this navigation issue:

B4X:
Private Sub B4XPage_CloseRequest As ResumableSub
    Return False
End Sub

It works (thanks @LucaMs) but I think that isn't the best solution (in this case).
From a user perspective, it is misleading because the user expects that icon to take him to the previous page but in reality nothing happens.
Is there a B4XPages native solution the allow to hide the back icon only for this specific page (B4XPage "Home") ?

Thanks in advance for your help.
Luca.
 

luke2012

Well-Known Member
Licensed User
Longtime User
B4X:
'Not good:
B4XPages.ShowPage("AppHome")

'Good:
B4XPages.ShowPageAndRemovePreviousPages("AppHome")

Thanks Erel. So each time that I don't need the back navigation icon I must use .ShowPageAndRemovePreviousPages("PageName") instead of .ShowPage("PageName")
 
Upvote 0

luke2012

Well-Known Member
Licensed User
Longtime User
B4X:
'Not good:
B4XPages.ShowPage("AppHome")

'Good:
B4XPages.ShowPageAndRemovePreviousPages("AppHome")

About MainPage, is it possible to hide the action bar and display only the page layout (in this case I show the animated gif splash) ? I mean, hide the action bar only for the MainPage not for all B4XPages within the App.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
So each time that I don't need the back navigation icon I must use
You should use it whenever you want to switch to a different page and remove the existing pages from the stack. One of the side effects is that the back icon will be removed.

About MainPage, is it possible to hide the action bar and display only the page layout (in this case I show the animated gif splash) ? I mean, hide the action bar only for the MainPage not for all B4XPages within the App.
This is a bit more complicated.

[B4X] [B4XPages] Splash Screen -
 
Upvote 0

luke2012

Well-Known Member
Licensed User
Longtime User
You should use it whenever you want to switch to a different page and remove the existing pages from the stack. One of the side effects is that the back icon will be removed.


This is a bit more complicated.

[B4X] [B4XPages] Splash Screen -

"This is a bit more complicated."
Do you mean that there is a solution but is complicated to implement for a B4X project or do you mean that the solution in not applicable in this case ?
 
Upvote 0
Top