android - onBackPressed() not working for me
<p>i have a program the first activity is a splash screen and the second is the log in and the third is list view menu activity and then 2 other activities
the splash screen disappear after 3 seconds and if the log in check box remember me is checked it goes directly to the menu page 
i Override the onBackPressed function in the menu activity so that it will exit the program directly after the user click back from the menu but if i have gone through the other activities it doesn't exit no it goes to the previous activity in the stack and the dialog box doesn't come out it actually does appear for a second no less and desapper right away
here is my  onBackPressed function</p>

<pre><code>    public void onBackPressed() {
   // TODO Auto-generated method stub
  // super.onBackPressed();
   AlertDialog.Builder builder = new AlertDialog.Builder(this);
   builder.setMessage("Are you Sure want to close the Application..?")
           .setCancelable(false)
           .setTitle("EXIT")
           .setNegativeButton("No", new DialogInterface.OnClickListener() {
               public void onClick(DialogInterface dialog, int id) {
                   dialog.cancel();
               }
           })
           .setPositiveButton("Yes",
                   new DialogInterface.OnClickListener() {
                       public void onClick(DialogInterface dialog, int id) {
                           finish();
                       }
                   });
   AlertDialog alert = builder.create();
   alert.show();
   //super.onBackPressed();
</code></pre>

<p>}</p>
