Android Question Help with "Cannot access activity object from sub"?

GuyBooth

Active Member
Licensed User
Longtime User
I am rewriting some code, and I have two classes clTracklist and clFlipFlopLoader. The following code is in a service:

B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Dim bPausedByPhone As Boolean
    Dim FlipFlopLoader As clFlipFlopLoader
    Dim lstTracks As clTrackList

I get this error message for the clFlipFlopLoader, and yet the cllstTracks has no such problems. Starting to tear my hair out (or what little I have left) over this one! Please anyone, any ideas? Must be something obvious....

clFlipFlopLoader Error.png
 

GuyBooth

Active Member
Licensed User
Longtime User
You will need to declare this object in Sub Globals.
Not sure I understand - this is a Service, I didn't think Sub Globals were an option. I also don't understand why the other class I declare (clTrackList) works fine.

For now, I have created a new service and am building it up. The addition of the same classes into its Process_Globals is so far working OK. Maybe there was some file corruption.
 
Upvote 0
Top