Android Question Advantages and disadvantages between "CallSubDelayed" and "Wait For"

vecino

Well-Known Member
Licensed User
Longtime User
Hi, both ways work apparently the same, but what are the pros and cons of using one or the other option.
Thank you.

B4X:
Sub timgv1_Click(X As Int, Y As Int)
    CallSubDelayed3("","ControlarUbicacion",X,Y)
End Sub

Sub ControlarUbicacion( X As Int, Y As Int )
  ' Do something here.
End Sub

B4X:
Sub timgv1_Click(X As Int, Y As Int)
    Wait For (ControlarUbicacion(X,Y)) complete (oRes As Object)
End Sub

Sub ControlarUbicacion( X As Int, Y As Int ) As ResumableSub
  ' Do something here.
  Return Null
End Sub
 
Solution

Jeffrey Cameron

Well-Known Member
Licensed User
Longtime User
Upvote 2
Solution

vecino

Well-Known Member
Licensed User
Longtime User
So, to summarize, I understand that CallSubDelayed continues to execute the following instructions. And WaitFor obviously waits for them to execute and then continues.
Thank you very much.
 
Upvote 0
Top