Android Question [B4XPages] CallSub of a Page from a Class

Mike1970

Well-Known Member
Licensed User
Longtime User
Hi everyone, i'm using B4XPages on Android and i have this scenario:
  1. I've a class that handles http requests (let's call A)
  2. I've a B4XPage (let's call B)
When the app is opened/resumed, a method of the A class is called, when it finishes his work it must call a Sub that is located in B (if it is disaplayed obvs.), to update the UI.

Blueprint of the code:
B4X:
Sub A As ResumableSub
    ... Work
   
    If B4XPages.GetManager.GetTopPage.Id == "B" Then CallSub(B, "UpdateUI") '<---- CallSub does not work for B4XPage
End Sub

How can i achive this result?

thanks in advance
 

Mike1970

Well-Known Member
Licensed User
Longtime User
Your code should work assuming that B was set correctly.

It is however not needed.
B4X:
If B4XPages.GetManager.GetTopPage.Id == "B" Then
B.UpdateUI
End If
But with this code B should be declared in the Globals of A (and intilialized again?)
 
Upvote 0

Mike1970

Well-Known Member
Licensed User
Longtime User
It is up to you. You can declare it wherever you like.
B4X:
Dim b As Page145 = B4XPages.GetPage("page 145 id")
b.UpdateUI
Oh ok, so i need to create another "Page" object and reference it to the already existing page, i thought it was reachable without. Thanks Erel :D
 
Upvote 0
Top