Where should we use finish() to end the application?
<p>In my application after the user goes from one activity to another and vice versa. Im calling the activities using Intents on the event "onClick".</p>

<pre><code>public void onClick(DialogInterface dialog, int whichButton) {
                    Intent intent = new Intent();
                    intent.setClass(Field.this,Boll.class);
                    startActivity(intent);
                    finish();
                }
</code></pre>

<p>After using the application when the back button is pressed then application must end and should go back to the Home screen. </p>

<p>However what happening in my app is, when the Back button is clicked the activities are still in the stack and are traced back one by one(i.e to their previous state), and finally returns back to the Home Screen.</p>

<p>I have learned that Android takes care of quitting the application, <a href="http://stackoverflow.com/questions/2033914/quitting-an-application-is-that-frowned-upon/2034238#2034238">from here</a></p>

<p>Please let me know where should i add the <code>finish()</code> in order to finsh all activities in the stack and go back to Home Screen(i.e to end the application).</p>
