If you're in a code module, you don't have the Activity object handy to reference.
Here's a simple sub (courtesy of Erel) that fetches the current B4A activity:
Here's a simple sub (courtesy of Erel) that fetches the current B4A activity:
B4X:
Sub getCurrentActivity As Activity
Dim r As Reflector
r.Target = r.GetActivityBA
Return r.GetField("vg")
End Sub