Android Question How can I reload a B4XPage?

Sergey_New

Well-Known Member
Licensed User
Longtime User
For Activity I do this:
B4X:
Sub cmbFontSize_SelectedIndexChanged (Index As Int)
    Starter.TextSize=Starter.TextSizeMin+Index
    function.setViewHeight(Activity)
    Activity.Finish
    StartActivity(Me)
End Sub
 
Solution
Okay. Then you should call your sub in B4XPage_appear rather than B4XPage_created.

But if you are okay with your post #6 too its fine

B4X:
Private Sub B4XPage_Appear
    'Your sub here
End Sub

Sergey_New

Well-Known Member
Licensed User
Longtime User
LucaMs, thanks!
Unfortunately, this does not raise B4XPage_Created.
I have the necessary actions take place there.
If there is no other solution, I will have to move the necessary actions to B4XPage_Appear.
 
Upvote 0

mcqueccu

Well-Known Member
Licensed User
Longtime User
B4X:
Sub cmbFontSize_SelectedIndexChanged (Index As Int)
    Starter.TextSize=Starter.TextSizeMin+Index
    
    '-------------------------------------------
    'function.setViewHeight(Activity)
    function.setViewHeight(Root) 'You can use Root or Me in place of Activity
    
    '-----------------------------------------
    'Activity.Finish
    'StartActivity(Me)
    B4XPages.ShowPageAndRemovePreviousPages("MainPage") 'Use the ID of the page you want to goto
End Sub
 
Upvote 0

Sergey_New

Well-Known Member
Licensed User
Longtime User
mcqueccu, my page to reload is "Settings".
This code works:
B4X:
Sub cmbFontSize_SelectedIndexChanged (Index As Int)
    Starter.TextSize=Starter.TextSizeMin+Index
    function.setViewHeight(Root)
    B4XPages.ShowPageAndRemovePreviousPages("MainPage")
    B4XPages.ShowPage("Settings")
End Sub
 
Upvote 0

mcqueccu

Well-Known Member
Licensed User
Longtime User
What of This. Change the MainPage to Settings and remove the last line

B4X:
Sub cmbFontSize_SelectedIndexChanged (Index As Int)
    Starter.TextSize=Starter.TextSizeMin+Index
    function.setViewHeight(Root)
    B4XPages.ShowPageAndRemovePreviousPages("Settings")
End Sub
 
Upvote 0
Top