Pergunta

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?

Foi útil?

Solução

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?

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top