Android Question callSubDelayed Activity-Start

FrankDev

Active Member
Licensed User
Longtime User
Hi
I have a question about

callSubDelayed X

I want to start an activity with' callSubDelayed'.
ALWAYS first - 'Activity_Create' is called first and executed completely?

or could make the following sense.

I call e. g. from the' main'.
callSubDelayed2(actTest,"anzeigen","test")
in the actTest there is then the entry sub

sub anzeigen (Param as String)
wait for (initOk = True)' probably not the correct syntax!
Toast Messageshow (Param, true)
end sub

where InitOk is initially set to' False' at the start of the activity.
and if everything is executed then InitOk = True

and only now the sub 'anzeigen' should show the toast message.

I hope they've described it a little understandably.

Regards Frank

Translated with www.DeepL.com/Translator :)
 

LucaMs

Expert
Licensed User
Longtime User
ALWAYS first - 'Activity_Create' is called first and executed completely?
Activity_Create will be executed more than one time only if you close the Activity (Activity.Finish).
If you call an its routine using CallSubDelayed more than once, Activity_Resume will be executed each time (if the Activity was in background).

wait for (initOk = True)' probably not the correct syntax!
Surely, you're not waiting for an event, here.
 
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
To clarify it, if the activity needs to be created then Activity_Create will be executed before the target sub.

The Wait For syntax is indeed incorrect. Check the resumable subs tutorial: https://www.b4x.com/etp.html

You cannot wait for a variable to change. I don't think that it is needed in your case but you can implement it with:
B4X:
Do Until initOk = True
 Sleep(100)
Loop
 
Upvote 0

FrankDev

Active Member
Licensed User
Longtime User
Hi

thank you very much for your feedback

I only want to display lists in my activity that are always displayed on different
SQL statements.

is this method with the CallsubDelayed + parameter the really good?

or is it also good to declare a global variable
e. g. starter parameters (params)
in which you pass the parameters and then choose
simply via
StartActivity
starts the activity.

regards Frank
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
This depends on the flow of the app.

If you want that the data are shown ONLY when the query is executed, it is ok to use CallSubDelayed and pass the data to be displayed as parameter.

If, however, the data must be consulted even at different times, I think you should store them in the activity itself (private data in Process_Globals) or, better, in a local file (KeyValueStore would be ideal) and load them whenever the Activity_Resume is executed (call a routine of the activity from Activity_Resume).
 
Last edited:
Upvote 0

FrankDev

Active Member
Licensed User
Longtime User
thanks for the answer.

The activity is the display of a report as a list.
So if you select a list in a report generator such as List&Labels or Crystal Reports and do not print it but display it on the screen.

In a pre-dialog, a compilation of the desired information is selected and an SQL is created from it.
this should then be passed to the activity which will be displayed here.
 
Upvote 0
Top