Android Question Exit application from a strange place

Arf

Well-Known Member
Licensed User
Longtime 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
Longtime 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.
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
Erel said several times: Note, you should not use ExitApplication let android choose when to kill your activity...


EDIT: "Master Erel..." :D
 
  • Like
Reactions: Arf
Upvote 0
Top