I have 2 activities in my app, and can't seem to share an object between them. I've added both activities as modules.
(1) In my main activity, I have ...
In the second activity, I have ...
But I get a compilation error...
"Error description: Undeclared variable 'blemgr' is used before it was assigned any value."
I tried moving the bleMgr declaration to the Service_Create sub in the Starter activity, but then it doesn't work in either activity.
(BTW, I'm initializing etc but not showing that as I don't see it being relevant here)
I am able to share an Int variable without any errors. Is there something specific about the BleManager2 that makes it have this issue? Or what else am I missing here?
Thanks.
(1) In my main activity, I have ...
B4X:
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Public bleMgr As BleManager2
End Sub
In the second activity, I have ...
B4X:
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("BLESelector")
bleMgr.Scan(Null)
But I get a compilation error...
"Error description: Undeclared variable 'blemgr' is used before it was assigned any value."
I tried moving the bleMgr declaration to the Service_Create sub in the Starter activity, but then it doesn't work in either activity.
(BTW, I'm initializing etc but not showing that as I don't see it being relevant here)
I am able to share an Int variable without any errors. Is there something specific about the BleManager2 that makes it have this issue? Or what else am I missing here?
Thanks.
Last edited: