Question

On exit button of my game

I used

 System.runFinalizersOnExit(true);
 System.exit(0);

I have also tried only

finish();

on game exit but its not working the game exits and restarts again. Can any one help me with this problem what is the solution?

Was it helpful?

Solution

Android (and some other mobile platforms, plus web) do not have a concept of "exiting" the app. User just goes to another app's activity and the system (eventually) clears the process from memory.

When your Activity is leaved it gets notified via lifecycle callbacks. There you can do cleanup if necessary.

Is quitting an application frowned upon?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top