How to close Android application?

后端 未结 22 1207
小蘑菇
小蘑菇 2020-11-22 07:17

I want to close my application, so that it no longer runs in the background.

How to do that? Is this good practice on Android platform?

If I rely on the \"ba

22条回答
  •  礼貌的吻别
    2020-11-22 08:11

    YES! You can most certainly close your application so it is no longer running in the background. Like others have commented finish() is the Google recommended way that doesn't really mean your program is closed.

    System.exit(0);
    

    That right there will close your application out leaving nothing running in the background.However,use this wisely and don't leave files open, database handles open, etc.These things would normally be cleaned up through the finish() command.

    I personally HATE when I choose Exit in an application and it doesn't really exit.

提交回复
热议问题