Android Question Results not updating

Hi
Calculations are done in B4XMainPage and results are displayed in 'Results' Page. The following code is in 'Results' Page:

B4X:
'TL,CM,PS,IO are public variables defined in B4XMainPage.
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    'load the layout to Root
    Root1.LoadLayout("resview")
    B4XPages.SetTitle(Me,"RESULT")
    Log("The result is TL "&B4XPages.MainPage.TL)
        html = File.GetText(File.DirAssets, "index.html")
        html=html.Replace("$TL$",B4XPages.MainPage.TL)
        html=html.Replace("$CM$",B4XPages.MainPage.CM)
        html=html.Replace("$PS$",B4XPages.MainPage.PS)
        html=html.Replace("$IO$",B4XPages.MainPage.IO)
        html=html.Replace("$result$",B4XPages.MainPage.totResult)
        web_Result.LoadHtml(html)
        web_Result.ZoomEnabled=False
End Sub
If I go back to B4XMainPage and another calculation is done, the new results are not displayed. The 'Results' Page still displays old results. How to ensure that the results are updated ?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
It is a bit too fluid to give a concrete example, however I see many cases where developers treat B4XPage_Appear as the B4XPage version of Activity_Resume.
In B4XPages you can directly access code and UI of other pages, so if you want to run any code or access another page UI, you can do it directly. No need to update the state in B4XPage_Appear.

It does make sense to use B4XPage_Appear to resume animated or also to update the state in some cases, however don't forget that you don't need to wait for the page to appear, before you can access its code and UI.
 
Upvote 0
Top