Android Question callsub2 into callsub2?

MbedAndroid

Active Member
Licensed User
Longtime User
just a question why this isnt processed in the why i expected.
it tried this:
B4X:
CallSub2("Main","DownloadAndSaveFile",Callsub2("Main","Document")
This isnt working in all cases.
In some cases the parameter from sub Document returns null, checking it that specific case it turns out that Document wasnt called at all, thus the parameter was null
This works in all cases:
B4X:
        Private document=CallSub("main","Document")  As String
        CallSub2("Main","DownloadAndSaveFile",document )
just curious why the first example isnt working all the time?? Timing in the queue?
 

MbedAndroid

Active Member
Licensed User
Longtime User
Tip: better to write Main instead of "Main"

My guess is that the target activity was paused. You can check it with IsPaused(Main).

Another tip: switch to B4XPages and everything will become simpler. The pages are never paused.
B4X:
        Log("entry downloadmanual")

        If IsPaused(Main) Then Log("is paused")

        CallSub2(Main,"DownloadAndSaveFile",CallSub(Main,"Document"))


thus wasn't paused.
Anyway, fixed in method 2. I will avoid those constructions as example 1
 
Upvote 0
Top