I use a common function to open Activity2 from Activity1 with the required parameter.
Activity1
function
Activity2
What is the correct way to do this in B4XPages for Page1 and Page2?
My version:
Page1
function
It is right?
Activity1
B4X:
function.openData("Activity2"),"setData", key)
' for other pages, the "setData" procedure will be different
B4X:
Sub openData(CallBack As Object, fn As String, key As String)
CallSubDelayed2 (CallBack, fn, key)
End Sub
B4X:
Sub setData(key)
' ...
End Sub
My version:
Page1
B4X:
function.openData("Page2","setData", key, False)
B4X:
Sub openData(IdPage As String, fn As String, key As String)
B4XPages.ShowPage(IdPage)
CallSubDelayed2 (B4XPages.GetPage(IdPage), fn, key)
End Sub