CallSubDelayed (Component As Object, Sub As String)
CallSubDelayed is a combination of StartActivity, StartService and CallSub.
Unlike CallSub which only works with currently running components, CallSubDelayed will first start the target component if needed.
CallSubDelayed can also be used to call subs in the current module. Instead of calling these subs directly, a message will be sent to the message queue.
The sub will be called when the message is processed. This is useful in cases where you want to do something "right after" the current sub (usually related to UI events).
Note that if you call an Activity while the whole application is in the background (no visible activities), the sub will be executed once the target activity is resumed.
B4A Tutorial Using CallSubDelayed to interact between activities and services - Erel    
Jun 14, 2012   
(17 reactions)   
tags: activity, two activity pass value, interact, between process global variables.
CallSubDelayed makes it much simpler. It allows you to call a sub in... automatically. When the target module is ready, the sub will be called.
CallSubDelayed doesn't... this message and passes it to the target module when it is ready.
CallSubDelayed can also be used... make it clear, you do not need to call StartActivity or StartService when you use CallSubDelayed.
CallSubDelayed is the recommended method for interaction between activities and services.
Note...
B4A Question [B4X] B4XPages - ShowPage with Parameters like CallSubDelayed2 - Alexander Stolte    
Jun 14, 2020How can i show a B4XPage with parameters?...
link: Once you understand how simple it is, you will realize that none of these things are needed.
Page2.SomeSubThatConfiguresEverythingN...
link: Declare some Public Global variables in the page to be shown, set them appropriately before showing it. and check those variables in ...
Wish Unlimited number of arguments when using CallSub/CallSubDelayed - LucaMs    
Jul 1, 2019 module and also using CallSubDelayed again from within the Activity.
I needed to modify that routine by adding a third parameter but CallSubDelayed3 can be used to pass two arguments only, as you know...)
I don't know if creating a CallSubDelayed4 (and CallSub4) that allows you to send...
B4A Question CallSubDelayed and code modules ? - b4auser1    
Feb 24, 2016https://www.b4x.com/android/forum/threads/using-callsubdelayed-to-interact-between-activities-and-services.18691/
CallSubDelayed makes it much simpler. It allows you to call a sub in a different service or activity.
In iHttpUtils2\HttpJob.bas I see
CallSubDelayed2(HttpUtils2Service, "SubmitJob", Me)
where iHttpUtils2\HttpUtils2Service.bas is code module.
So in B4i I can apply CallSubDelayed to Code modules. Is it possible to do the same in B4A ?...
B4A Question CallSubDelayed to open an Activity - LucaMs    
Jul 28, 2018 (routine)
** Activity (main) Resume **
srvservice uses CallSubDelayed to call a routine of act2... of act2
sending message to waiting queue (CallSubDelayed - Routine)
** Activity (main) Resume **
srvservice uses CallSubDelayed to call a routine of act2, which is never executed.
...
Bug? Callsubdelayed and services, function not being called. - Jmu5667    
Feb 9, 2023Hello
I would like to know if I am wrong in the following assumption. Previously when using callsubdelayed(my_service,"some_function"), if the service was not running it would be started and then the function would be called.
I have noticed recently with the new version of B4A, this does not seem to the case. the service is started but the function is not called.
Regards
John....
link: Works fine when I test it......
B4A Question Advantages and disadvantages between "CallSubDelayed" and "Wait For" - vecino    
Dec 9, 2021Hi, both ways work apparently the same, but what are the pros and cons of using one or the other option.
Thank you.
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...
link: So, to summarize, I understand that CallSubDelayed continues to execute the following instructions...
link: They are very different mechanisms. With CallSubDelayed execution continues, and the called method...
B4A Question callsubdelayed2 how to close activity - tsteward    
Apr 26, 2021 a button on activity 2 calls callsubdelay2 to open activity3 "Feedback" when complete it uses callsubdelay2 to return to Vehicle and process and save the data collected in Feedback.
Whilst in...
link: Nearly 18 activities and probably 10,000 lines of code 9 years in the making.
Appreciate the sentim...
link: I'm sure you already know it: B4xPages solve any problem due to an app's lifecycle.
My sugg...
link: ok activity.finish after the callsubdelay seems to work
Thank you...
B4A Question [SOLVED] How to mimic CallSubDelayed2 in B4XPages? - incendio    
Jan 17, 2021Hi guys,
In Activities based app, I use this code
Sub btn_click
CallSubDelayed2(myMod,"ShowInfo","Info")
End Sub
That codes will bring myMod into active activity and Call sub ShowInfo.
How to mimic this behaviour in B4Pages based app?...
link: Everything is simpler with B4XPages.
You can directly call methods of other pages.
Best to create the other page with B4XPages.AddPageAndCreate.
SecondPage.ShowInfo("info")
B4XPages.ShowP...
B4A Question [SOLVED] - Blocked messages in queue when using CallSubDelayed - rleiman    
Nov 26, 2020. The song is played by using CallSubDelayed. As soon as I get the app in focus be having it open on screen... with the phone screen off.
Schedule For Song 1 is running.
sending message to waiting queue (CallSubDelayed...
link: https://www.b4x.com/android/forum/threads/b4xpages-loading-layouts.124969/...
link:
Please keep an eye for the new thread
Where is it?...
link:
103650;)
Please keep an eye for the new thread. Thanks so much for the advice on migrating to B4XP...
Page: 1  
2  
3  
4  
5  
6  
7