Difference between finish() and System.exit(0)

Actually there is no difference if you have only one activity. However, if you have several activities on the stack, then:

  • finish() – finishes the activity where it is called from and you see the previous activity.
  • System.exit(0) – restarts the app with one fewer activity on the stack. So, if you called ActivityB from ActivityA, and System.exit(0) is called in ActivityB, then the application will be killed and started immediately with only one activity ActivityA

Leave a Comment