I have the following code in a code module:
I call it from the Starter (Service) module within a Tick event for a timer, but get the NullPointerException error on the line indicated above. I tried GetActivity and got a similar error (and, from what I understand, GetActivityBA is correct). Is the error caused because I'm calling it from the Starter module?
P.S., I have the Reflection library included.
B4X:
Sub getCurrentActivity As Activity
Dim r As Reflector
r.Target = r.GetActivityBA 'this line causes NullPointerException
Return r.GetField("vg")
End Sub
I call it from the Starter (Service) module within a Tick event for a timer, but get the NullPointerException error on the line indicated above. I tried GetActivity and got a similar error (and, from what I understand, GetActivityBA is correct). Is the error caused because I'm calling it from the Starter module?
P.S., I have the Reflection library included.