Android Question problem with Wait For debugging and brack point

Dey

Active Member
Licensed User
Longtime User
B4A V8.30

I attach demo program
press TEST button and watch log
then insert a break point in Sub Execute es. at line 36 or 39
re-run TEST
it can be noted that pause_status value is not correct
You can verify ?
Without brack point it seems to work correctly
Thank you

sorry for the english translated with google
 

Attachments

  • TestWaitFor.zip
    9.7 KB · Views: 118

Dey

Active Member
Licensed User
Longtime User
The issue here will only happen in very specific cases. There are also better way to design this code. You can use CallSub with a sub that returns a ResumableSub. Exactly like you do with local subs.

This way you will not need to poll a global variable.
my problem is
working on servers there can be operations that take a few seconds
and users in this case put the device in standby
when I wake up I need to understand where I arrived
Please give me an example to improve the code?
thanks for your time
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Your current code will not work if the activity is paused. You should move whatever you can to the starter server and only use the activity to update the UI.

The exact code depends on your requirements. I recommend you to watch this tutorial:


The general pattern is:

- Do everything in a service. Starter service is a good place.
- Store the relevant state in process_global variables.
- Call an "Update State" sub in the activity whenever the state changes.
- Call this sub from Activity_Resume.

This way the activity will always show the latest state.
 
Upvote 0
Top