What is the difference between back button and finish ?

You can call finish() from your code; you can't press the back button from code. Normally, pressing the back button results in a call to finish(). The difference is whether you want your code or the user to initiate the action.


If you have not Override onBackPressed() method from your Activity then, it will invoke finish() for your Activity. You don't need to call finish() explicitly..

So by that it will display Activity which is in the top of the Activity Stack. And there is empty Stack then you will quite from the application.

If you have Override onBackPressed() method then You have to call finish() explicitly to destroy activity.

Tags:

Android