Closing Application and killing it from ram

后端 未结 3 1340
忘了有多久
忘了有多久 2021-01-26 08:41

hi I want to close my application and also want kill it from ram by clicking button. i am using this method, but it just minimize application and didn\'t close complete app. wha

3条回答
  •  南笙
    南笙 (楼主)
    2021-01-26 09:40

    System.exit will exit the VM and Android will kill this process.

    Activity#finish() is usually the popular choice, but this does not need to be executed right away and also only affects this particular Activity, not the whole process.

    Just FYI: killing apps manually is not a good app design in Android (except maybe some special situations). If you could explain why you want to kill your app, we can probably tell you a better solution.

提交回复
热议问题