There are several mistakes in this code:
1. If you want to wait for a sub to complete then you should make it return a ResumableSub object and use this syntax:
Wait For (HttpJobSim1) Complete(Result As Object) 'you can change the result type
[B4X] Resumable subs that return values (ResumableSub)
2. Wait For doesn't block the program flow. Wait For is equivalent to Return where the sub will be resumed at a later point:
[B4X] Resumable Subs - Sleep / Wait For
This means that Activity_Create will be executed before Service_Create is resumed and completed.
If you want that Activity_Create will wait for the resumable Service_Create to complete then you will need to change Activity_Create to:
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
Wait For Service_Complete
End If
Log("Starter.MyVar = " & Starter.MyVar)
End Sub
'and service create:
Sub Service_Create
Wait For (MyRoutine) Complete (Result As Int)
MyVar = Result
CallSubDelayed(Main, "Service_Complete")
End Sub
I think that it is a mistake to wait for the httpjobs to complete before you load the layout. A better approach is to use CallSubDelayed to call a different sub in the activity.