I have an issue with my app that is difficult to reproduce. On rare occasions, when the user goes to exit the app ("back out") from the main screen, the app appears to restart itself. What I think is really happening is that there is more than one instance of the main activity in the activity stack. I've had the app appear to restart once (on several occasions) but a customer recently told me that one time he had to exit the app 3 times in a row to get it to actually exit.
I always use Activity.Finish when UserClosed = True in Activity_Pause but I think this problem pops up from the user randomly using the back key AND the Home key to leave the app. Naturally there is no way to detect the Home key (doesn't even trigger the Activity_KeyPress event) so I can't account for this.
In addition to how the user leaves the app, I think this problem is being compounded by the following:
1) The user can start the app from the main app shortcut.
2) The user can also start a specific activity (NOT the main activity) through a special home screen shortcut that starts that specific activity.
3) The user can also start/resume the app by pressing on a notification.
4) The user can also resume the app from the recent apps list.
Somehow the combination of how the user enters and exits the app seems to be causing more than one instance of the main activity to be in the activity stack.
Does anyone have any ideas on how to fix this? Is there a command in B4A to clear the app's activity stack? If not, would it be possible to add one?
I always use Activity.Finish when UserClosed = True in Activity_Pause but I think this problem pops up from the user randomly using the back key AND the Home key to leave the app. Naturally there is no way to detect the Home key (doesn't even trigger the Activity_KeyPress event) so I can't account for this.
In addition to how the user leaves the app, I think this problem is being compounded by the following:
1) The user can start the app from the main app shortcut.
2) The user can also start a specific activity (NOT the main activity) through a special home screen shortcut that starts that specific activity.
3) The user can also start/resume the app by pressing on a notification.
4) The user can also resume the app from the recent apps list.
Somehow the combination of how the user enters and exits the app seems to be causing more than one instance of the main activity to be in the activity stack.
Does anyone have any ideas on how to fix this? Is there a command in B4A to clear the app's activity stack? If not, would it be possible to add one?
Last edited: