Android Question CallSub to Resumable Sub - Current delaration does not match previous one, result

RJB

Active Member
Licensed User
Longtime User
With this code in a service:
B4X:
Sub Test1String As ResumableSub
 Return "String"
End Sub
Sub Test2Boolean As ResumableSub
 Return True
End Sub
This code in Main:
B4X:
 Wait For(CallSub(TestService, "Test1String")) Complete (result As String)
Wait For(CallSub(TestService, "Test2Boolean")) Complete (result As Boolean)
gives:
"Current delaration does not match previous one.
result"
on the second line.

Using:
B4X:
 Dim rs1 As ResumableSub = CallSub(TestService, "Test1String")
 Wait For (rs1) Complete (result As String)
 Dim rs2 As ResumableSub = CallSub(TestService, "Test2Boolean")
 Wait For (rs2) Complete (result As Boolean)
gives the same result

Any suggestions as to why, and how to correct it?
 

RJB

Active Member
Licensed User
Longtime User
What is the type of 'result' after these two lines?

B4X:
Wait For(CallSub(TestService, "Test1String")) Complete (result1 As String)
Wait For(CallSub(TestService, "Test2Boolean")) Complete (result2 As Boolean)
I'm not sure that I understand the question but that does solve the problem - and the reason is obvious when you see it. Thanks
 
Upvote 0
Top