B4J Question [server] Background Workers

woniol

Active Member
Licensed User
Longtime User
Hallo,
I would like to call a method defined in a Background Worker class from a Main.
Is it possible to get the instance of background Worker class?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Yes. Create a public variable in the Main module and set it from the Initialize method of the worker class:
B4X:
Sub Initialize
 Main.Worker = Me
 ...
End Sub

You should use CallSubDelayed to call the worker methods. Otherwise they will be executed by the calling thread instead of the background worker thread.
 
Upvote 0
Top