In surfaceDestroyed() , I pass a flag to stop the game and try to stop the flow.

If you try to minimize the Home button, surfaceDestroyed() is called and surfaceDestroyed() is called when returning to the program. If you lock the screen with the power button, the surfaceDestroyed() not called, i.e. I can't stop the flow ...

And the second question: if you press the back button, the protected void onDestroy(){ Log.d(TAG,"Destroying..."); super.onDestroy(); } method protected void onDestroy(){ Log.d(TAG,"Destroying..."); super.onDestroy(); } is called protected void onDestroy(){ Log.d(TAG,"Destroying..."); super.onDestroy(); } protected void onDestroy(){ Log.d(TAG,"Destroying..."); super.onDestroy(); }

How to make the back button not kill the application? And how to stop the flow if I lock the screen with the power button?

Well, the material for thought:

https://stackoverflow.com/questions/11495842/how-surfaceholder-callbacks-are-related-to-activity-lifecycle

http://ru.androids.help/q22562

    0