Android Question [Solved] Main Activity_Pause(UserClosed) always shows UserClosed=False when back button is pressed.

Fernando Solá

Member
Licensed User
It was working fine, but at some point it started doing this weird thing that whenever I touched the back key on the screen while on the Main Activity, instead of writing in the log: ** Activity (main) Pause, UserClosed = true **, I noticed it was saying UserClosed = false. :confused:

I searched the forum for any kind of similar situation without any luck. I even tried it on two different devices and an emulator with the same result.

So I backed up the whole folder and started going backwards removing code, libraries, files, manifest settings. At every step and run I cleaned up the project, just to be sure. I finally stopped when I got to a barebones, basic structure and the issue still persisted.

I can't seem to pinpoint where the issue started and if it can be fixed by any means different to importing my code (modules, files, layouts) into a new project hoping it will not happen again or just waiting to see if it happens again.

So I'm attaching a video showing the issue.

Has anyone encountered anything like this? And if so... how did you fix it?


Edit: The solution was to add the Activity_KeyPress event.
 
Last edited:
Solution
If I add the Activity_Press Event it works as expected, giving UserClosed = true.

This fixes the issue.:
Sub Activity_KeyPress (KeyCode As Int) As Boolean 'Return True to consume the event
    Return False
End Sub

👍

Fernando Solá

Member
Licensed User
If I add the Activity_Press Event it works as expected, giving UserClosed = true.

This fixes the issue.:
Sub Activity_KeyPress (KeyCode As Int) As Boolean 'Return True to consume the event
    Return False
End Sub

👍
 
Upvote 0
Solution
Top