Android Question (SOLVED) - Is it possible to return more than 1 value in Resumable Subs?

Myr0n

Active Member
Licensed User
Longtime User
Hi everybody

Is it possible to return moren than 1 value in resumable subs like
B4X:
Dim SenderFilter As Object = sql.ExecQueryAsync("SQL", "SELECT * FROM table1", Null)

Wait For (SenderFilter) SQL_QueryComplete (Success As Boolean, rs As ResultSet) '<=== like 
SQL_QueryComplete
if yes, how can I do it?

Thank you
 

Myr0n

Active Member
Licensed User
Longtime User
Well i would love to know how to implement a method signature to return 2 values or more from a custom method.

Thx
 
Upvote 0

Myr0n

Active Member
Licensed User
Longtime User
Put them both into a map and return the map.
As far as i know you can not return multiple values from a sub. Not in a normal way and even not in a resumeable sub.
Is exactly what I am doing, but i was thinking to implement a solution like the jdbcsql library works.

Thx
 
Upvote 0

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
yes it is possible. think this:
Wait For (SenderFilter) SQL_QueryComplete (Success As Boolean, rs As ResultSet) '<=== like

as a simple Sub. how do you call a sub then? with Callsub3 and Callsubdelayed3 (better the later)

B4X:
private sub yourSub
wait for yourResumableSub_Complete(args1 as int, args2 as int)

end sub

private sub yourAnotherSub
do something... 
callsubdelayed3(me,"yourResumableSub_complete",args1,args2)
end sub

just watch out i did not test the code.
 
Upvote 0

Myr0n

Active Member
Licensed User
Longtime User


I gonna try and i get back to you.

Thx
 
Upvote 0

Myr0n

Active Member
Licensed User
Longtime User
Thank you so much for everyone.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
And if you do it like this, you don't even need to use Wait For, surely?
Wait For is needed because we assume that DoSomething is a resumable sub. There is no other reason to use Wait For.

B4X:
Sub DoSomething As ResumableSub
 'Download something
 'wait for result
 Return Array(1, 2, "c")
End Sub
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…