Android Question How this code work?

Discussion in 'Android Questions' started by LucaMs, May 1, 2019.

  1. LucaMs

    LucaMs Expert Licensed User

    From this tutorial:

    CallSubDelayed3(GeofenceService, "AddGeofence", Me, geo)
    Wait For Geofence_Added (Success As Boolean)
    Log("Geofence added: " & Success)
    End If
    End Sub
    As far as I know, CallSubDelayed will launch the routine AddGeofence only upon completion of the current routine.

    Is that piece of code correct? And... "why"?

    [I haven't tried that code; maybe I'll do it, just out of curiosity, it's interesting.]
  2. Erel

    Erel Administrator Staff Member Licensed User

    Yes. You forgot rule #1 of resumable subs: a call to Wait For or Sleep is equivalent to a call to Return from the calling method perspective (calling method = the method that called this sub).
  3. LucaMs

    LucaMs Expert Licensed User

    This is one of the few things my poor memory can remember :D:(.

    The fact is that I assumed that CallSubDelayd could do its job only when executing the "End Sub" (and the code between these two commands).
    victormedranop likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice