Activity_Pause not executing

nfordbscndrd

Well-Known Member
Licensed User
Longtime User
I'm just getting to saving program settings in my app, but Activity_Pause is not pausing. I've done some reading on here, but don't see what I'm doing wrong. The tutorial says:

As discussed above Activity_Pause is called every time that the activity moves from the foreground to the background. This can happen because:
1. A different activity was started.
2. The Home button was pressed
3. A configuration changed event was raised (orientation changed for example).
4. The Back button was pressed.

First I put a breakpoint in Activity_pause and did each of the above with no catch. Then I added a MsgBox and did each of the above and still nothing. Activity_Resume always fires. What am I missing?
 

agraham

Expert
Licensed User
Longtime User
Put a Log statement in the pause and you will see that it is executing. Msgboxes, because they are modal and so halt the code execution in the Sub, cannot be displayed in Activity_Pause. There is explicit code in Basic4android to disallow this. Dialogs and a debugger break are also not allowed because they use the same underlying mechanism to achieve modality.
From the bottom of this post by Erel.

Notes about the debugger:
- Breakpoints in the following subs will be ignored: Globals, Process_Globals and Activity_Pause.
 
Last edited:
Upvote 0

nfordbscndrd

Well-Known Member
Licensed User
Longtime User
Put a Log statement in the pause and you will see that it is executing. Msgboxes, because they are modal and so halt the code execution in the Sub, cannot be displayed in Activity_Pause. There is explicit code in Basic4android to disallow this. Dialogs and a debugger break are also not allowed because they use the same underlying mechanism to achieve modality.

I changed the MsgBox to a Log and see the pause in the logs, so I'm good to go now. What was throwing me was that the breakpoint was working in the Resume, but not in the Pause, but I understand why now that you've explained it. Thanks.
 
Upvote 0
Top