I assume that Main.Testing is a resumable sub. Otherwise you don't need to do anything special.
B4X:
Sub Testing As ResumableSub
...
'different module
Dim rs As ResumableSub = CallSub(Main, "Testing")
if rs.IsInitialized Then
Wait For (rs) Complete (Result As Object)
'after
Else
Log("Activity was paused")
End If
I assume that Main.Testing is a resumable sub. Otherwise you don't need to do anything special.
B4X:
Sub Testing As ResumableSub
...
'different module
Dim rs As ResumableSub = CallSub(Main, "Testing")
if rs.IsInitialized Then
Wait For (rs) Complete (Result As Object)
'after
Else
Log("Activity was paused")
End If
I thought Anything after CallSub will have to wait for the sub to be completed? But when you use CallSubDelayed it will go to next code with out waiting?
Can this be used with CallSubDelayed. I want to unpause the Main and make the call and wait for completion.
Sub Service_Create
'different module
Dim rs As ResumableSub = CallSub(Main, "Testing")
If rs.IsInitialized Then
Wait For (rs) Complete (Result As Object)
Log("AFTER WAITING")
Else
Log("Activity was paused")
End If
End Sub
B4X:
Sub Testing As ResumableSub
Log("TESTING")
End Sub
'Result
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
*** Service (doing) Create ***
TESTING
** Service (doing) Start **
AFTER WAITING
** Activity (main) Pause, UserClosed = true **
** Service (starter) Destroy (ignored)**
** Service (doing) Destroy **