In main, or the activity where you instantiate your class
myClass.initialize(nativeMe) 'this is the global activityContext
and in your class
Sub Class_Globals
Private nativeMe As JavaObject
Private CallerContext As JavaObject
End Sub
'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize( CallerActivityContext As JavaObject)
nativeMe = Me
CallerContext=CallerActivityContext
Log(nativeMe.RunMethod("mymethod", Array (CallerContext,...)))
End Sub
if it is a code module, then do the same, passing the activity context as one of the arguments of that Sub in the code module