Android Question B4XPage and Public Variables

Sabotto

Active Member
Licensed User
I apologize in advance if what I'm about to ask may be trivial

I have three doubts regarding the B4XPages and Public variables:
1) How do I call a Public variable in a B4XPage from another B4XPage?
2) If that variable must be visible from two pages, in which of them is it better to declare it? Is indifferent? (Obviously excluding a specific Module)
3) In Sub Initialize, what goes?
B4X:
'In B4XMainPage'
Sub Class_Globals
    Private Root As B4XView
    Private xui As XUI
    Public MyVar as Int ' Do I declare it here? Or in B4XPage2?
End Sub

Public Sub Initialize
'What goes here?
End Sub

'In B4XPage2
Log(B4XMainPage.MyVar) ' Error!!! How should I write?
 
Top