How to quit android application programmatically

前端 未结 30 2463
迷失自我
迷失自我 2020-11-22 03:06

I Found some codes for quit an Android application programatically. By calling any one of the following code in onDestroy() will it quit application entirely?

30条回答
  •  没有蜡笔的小新
    2020-11-22 03:21

    If you're using Kotlin, the proper way to exit the app and alternative to System.exit() is a built-in method

    exitProcess(0)
    

    See the documentation.

    Number 0 as a parameter means the exit is intended and no error occurred.

提交回复
热议问题