Android Question What is this behaviour?

tigrot

Well-Known Member
Licensed User
Longtime User
Hi everybody,
I'm trying to understand the behaviour of this sequence of code.
B4X:
   Activity.Finish
   StartActivity(camera)
   camera.npreview=0
   timx.Enabled=False
   Activity.finish
the first activity.finish should terminate the activity but the code runs till the second, which is the last instruction of the sub.(the first finish is a refuse from a cut and paste, not seen before).

I have written this :
B4X:
ToastMessageShow("Prima",False)
Activity.Finish
Msgbox("Dopo","test")
This code displays a toastmessage, terminates and displays no msgbox

B4X:
ToastMessageShow("Prima",False)
Activity.Finish
ToastMessageShow("Dopo",False)

This code generates two toastmessages as aspected.

What I think is that the msgbox must have a parent window(like in Windows OS) and cannot run standalone.
Thank you in advance for your explanations!

Mauro
 

DonManfred

Expert
Licensed User
Longtime User
Activity.finish will be executed and the end of the sub not directly!

Dont use a messagebox here.
 
Upvote 0

tigrot

Well-Known Member
Licensed User
Longtime User
Thank you Don. That what I noticed. I have the need to call a phone, close an activity and start another one(in this case the MAIN) and sometimes the call is not started. I was asking myself why this could happen. I don't get an error, simply the call is not started!

Mauro
 
Upvote 0

tigrot

Well-Known Member
Licensed User
Longtime User
I'll try the best solution between those pointed from you. The problem is why the intent for calls SOMETIMES doesn't work? Till I'll explain the behaviour my APP will not always work well. In case I put the call on the last statement of the sub, 99% chance it won't start! Since it's complex anti-aggression system, I must be SURE it works!
 
Upvote 0
Top