Android Question B4XPages Correct way to call Sub in a different page.

walterf25

Expert
Licensed User
Longtime User
Hi All, what is the correct way to call a sub that is in a different b4xpage.

For Example, I have a page called PairDevice, in this page I handle all the BLE connection and communication, when data is received from the desired id in the Characteristic Map, I then proceed to call a sub in a different B4XPage named ManualSettings.

Is this the correct way to call that sub

B4X:
Dim mcall As Object = B4XPages.GetPage("ManualSettings")
Dim shorts() As Short = bc.ShortsFromBytes(datacontent)
Dim resp As Int = shorts(0)
CallSubDelayed2(mcall, "ChairCMDResponse", resp)

Or This the correct way of calling that sub?
B4X:
Dim shorts() As Short = bc.ShortsFromBytes(datacontent)
Dim resp As Int = shorts(0)
B4XPages.GetPage("ManualSettings").As(ManualSettings).ChairCMDResponse(resp)

The Sub in the ManualSettings is the following.
B4X:
Sub ChairCMDResponse(resp As Int)
    
End Sub

What is the correct way?

Thanks,
Walter
 
Top