Android Question Public Variables in VB4A

trepdas

Active Member
Licensed User
unfortunately , I still have problems implementing the difference with private and public variables in b4a.

in vb6 I used to create an external module and declare there the public variables (to be accessed from anywhere)



in vb4a I have two variables. let's say :
B4X:
MP As MediaPlayer

Public MuteFlag As Boolean




I try to put those in the starter module inside the Sub Process_Globals

but when I try to access it from another activity - it won't work.


the only way I could compile it is by declaring it in the main module in the Sub Process_Globals

and then use :

B4X:
Main.MP.Load (File.DirAssets, "sound.wav")         

            If Main.MuteFlag = False Then
            Main.MP.Play

End If


So

where would I declare MuteFlag and call it from any module by it's name (without the Main.Muteflag)

lots of text for a newbie question, I know.

any kind of example codes or help or a link to a tutorial will be very appreciated

Thanks
 

DonManfred

Expert
Licensed User
Longtime User
There is NO SUCH THING like
VB4A

The language is b4x and your question is about B4A
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0
Top