Android Question Variables defined in starter not available in main activity

I'm defining and initializing a set of vars in the Starter service:

B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Public Sspin_UUID, AvgSpeed_UUID, MaxSpeed_UUID, MinSpeed_UUID, MaxSpeedPrc_UUID, MinSpeedPrc_UUID, Wow_UUID, Flutter_UUID As String
    Public WFweighted_UUID, AvgSpeedPrc_UUID, WFunw_UUID, Att2Sigma_UUID, ModFreq_UUID, DeviceId_UUID, SpeedPoints_UUID As String
    Public AvgSpeed, AvgSpeedPrc, MaxSpeed, MinSpeed, MaxSpeedPrc, MinSpeedPrc, Wow, Flutter, XonXoff_UUID As String
    Public WFweighted, WFunw, Att2Sigma, ModFreq, DeviceId As String
    Public SpeedArray(10000) As Byte            ' 10000 = 5 x 2000
    Public SpeedMode As Boolean
    Public CurrBlePack(1) As Byte


Sub Service_Create
    'This is the program entry point.
    'This is a good place to load resources that are not specific to a single activity.
    ModFreq = ""
    CurrBlePack(0) = 0
    
    Sspin_UUID = "139c6edd-b9b0-454d-ad41-c1788cf25135"
    AvgSpeed_UUID = "d2b98d17-6e55-4697-8c8a-4d67068dc38f"
    AvgSpeedPrc_UUID = "60c2d02e-722b-4374-b3a2-934ee9e515d8"
    MaxSpeed_UUID = "6f89fb06-89e7-4812-92e9-6c460a90f590"
    MinSpeed_UUID = "597baa93-282f-447c-9286-f3e52e038ad6"
    MaxSpeedPrc_UUID = "5f57a360-538f-4c5d-90d1-8fb2436cbd85"

However when I first try to use them in the Main activity, I get "undeclared variable" errors when compiling (and they're all highlighted in red...)
What am I missing ?
 

klaus

Expert
Licensed User
Longtime User
You are missing the Starter prfix.

Any process global variable declared in a module need the module name where they are declared as a prefix!
Same for Public Subs.

Example:
B4X:
Starter.SpeedMode
 
Upvote 0
Top