Android Question Exit application from a strange place

Arf

Well-Known Member
Licensed User
My main activity starts a Service that does a bunch of stuff in the background.
One of the things the service does, is monitor how many times a certain event occurs, at which point it starts a new activty which is basically a Goodbye screen with an exit button.

Clicking the exit button just does this:
B4X:
Sub QuitButton_Click
    ExitApplication
End Sub
On entry into the 'goodbye' activity, the Service is stopped as the activity calls StopService from it's Create function.

The strange thing (or maybe not so strange) is that the app quits, but it restarts right away.
Is this because I have selected a very untidy place to exit, or started an activity from a Service?
Thanks
 

Arf

Well-Known Member
Licensed User
I got it to behave itself, QuitButton sets a global flag to close the app and ends itself, then the main activity stops the service and ExitsApplication when it sees the flag.
 
Top