Closing the activity after clicking positive button in alert dialog in android
<p>i have activity called "A" which displays the list of items.On clicking update button it shows the custom dialog (activity is showed in the back)with the list of items selected.When Order button inside custom dialog is clicked .</p>

<ol>
<li>Custom dialog disappears.</li>
<li>progress dialog is showed(since order working is going on)</li>
<li>then progress dialog is closed after the order work is done</li>
<li>i ll show the alert dialog saying "Order confirmed"</li>
<li>When i click the positive button in alert dialog i want to close the activity which in the back(ie Activity A).Want to move to Home screen</li>
<li>How can i call the finish code inside the alertdialog positive button Onclicklistener()</li>
</ol>

<p>Kindly help me to solve this problem.</p>

<pre><code>noData.setPositiveButton("Ok", new DialogInterface.OnClickListener(){
    @Override
    public void onClick(DialogInterface dialog, int which) {
        dialog.cancel();
    }
});
</code></pre>

<p>How can i add the finish() after cancelling the alertDialog()</p>
