Don't confuse CallSubDelayed and CallSub. CallSub called the method immediately. CallSubDelayed sends a message to the message queue which calls the sub when the message is processed.
Using CallSubDelayed to interact between activities and services
Pass an array or Map as one of the parameters.
CallSub2(MyService, "MySub", CreateMap("X": 100, "Y": 200))
...
Sub MySub(args As Map)
Dim x As Int = args.Get("X")
End Sub
Thanks Erel,
But I need to use Callsub to interact between Activities and Services... NOT CallSubDelayed..
I need to run inmediately, because the rest of execution dependes of Services results.
I'm using DonMamfred MySQL Lib, and he recomend to me that every Routines need to be in a Service... I have all in the Activity and work fine... but as Best Practice, I could migrate all main code to a Service.. but this idea still does not convince me at all
I need each command is executed sequentially, not everything can be asynchronous
But I want to learn to use the best way B4A
Thanks Erel