Issue
This discussion (in the comments) raised an interesting question :
What is the result of calling exit
in an Android app (with regards to the android life-cycle) and can that damage the OS ?
Solution
What is the result of calling exit in an Android app (with regards to the android life-cycle)
The Android documentation for System.exit() says that it "Causes the VM to stop running and the program to exit." I just tried it and it seems to kill the process for the app that called System.exit().
In the Android Developers thread named Activity.finish() x System.exit, someone corroborates that "System.exit() kills your entire process."
Dianne Hackborn aka hackbod goes further "To be clear: using System.exit() is strongly recommended against, and can cause some poor interactions with the system. Please don't design your app to need it."
and can that damage the OS ?
It should not damage the OS. Android will just let your app kill its process, not any other process on the system. It will keep the rest of the system running while your app ends.
I also verified this by running two applications and making one of them call System.exit(). The other was unaffected.
Answered By - louielouie
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.