title: When I press back button on login page it will go to main menu (after I select yes for logout in MainMenu activity)
body: <p>This is part of my MainMenu.java</p>
  
  <pre><code>public class MainMenu extends Activity{
  
  Button userinfo,requestservice,makepayment,trackparcel,checkcard;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main_menu);
      // Show the Up button in the action bar.
      setupActionBar();
      userinfo = (Button) findViewById(R.id.userinfo);
      requestservice = (Button) findViewById(R.id.requestservice);
      makepayment = (Button) findViewById(R.id.makepayment);
      trackparcel = (Button) findViewById(R.id.trackparcel);
      checkcard = (Button) findViewById(R.id.checkcard);
  
      userinfo.setOnClickListener(new View.OnClickListener() {
  
          @Override
          public void onClick(View v) {
              // TODO Auto-generated method stub
              Intent intent = new Intent(MainMenu.this, UserInfo.class);              
              startActivity(intent);
          }
      });
      requestservice.setOnClickListener(new View.OnClickListener() {
  
          @Override
          public void onClick(View v) {
              // TODO Auto-generated method stub
              Intent intent = new Intent(MainMenu.this, RequestService.class);
              startActivity(intent);
  
          }
      });
      makepayment.setOnClickListener(new View.OnClickListener() {
  
          @Override
          public void onClick(View v) {
              // TODO Auto-generated method stub
              Intent intent = new Intent(MainMenu.this, Payment.class);
              startActivity(intent);
  
          }
      });
      trackparcel.setOnClickListener(new View.OnClickListener() {
  
          @Override
          public void onClick(View v) {
              // TODO Auto-generated method stub
              Intent intent = new Intent(MainMenu.this, TrackParcel.class);
              startActivity(intent);
          }
      });
      checkcard.setOnClickListener(new View.OnClickListener() {
  
          @Override
          public void onClick(View v) {
              // TODO Auto-generated method stub
              Intent intent = new Intent(MainMenu.this, CheckCard.class);
              startActivity(intent);
          }
      });
  
  }
  
  public void onBackPressed() {
      new AlertDialog.Builder(MainMenu.this).setTitle("Logout")
      .setMessage("Would you like to logout?")
      .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int which) { 
              Intent intent = new Intent(MainMenu.this, Login.class);
              SharedPreferences sp = PreferenceManager
                      .getDefaultSharedPreferences(MainMenu.this);
              Editor edit = sp.edit();
              edit.clear();
              edit.commit();
              startActivity(intent);
          }
       })
      .setNegativeButton("No", new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int which) { 
              // user doesn't want to logout
          }
       })
      .show();
  }
  </code></pre>
  
  <p>This is part of my Login.java</p>
  
  <pre><code>public class Login extends ActionBarActivity implements OnClickListener {
  
  private Button login, register;
  private EditText email, password;
  
  JSONArray loginposition = null;
  // Progress Dialog
  private ProgressDialog pDialog;
  
  // JSON parser class
  JSONParser jsonParser = new JSONParser();
  
  private static final String LOGIN_URL = "http://XXX.XXX.X.XX:1234/PMSS/login.php";
  // JSON element ids from repsonse of php script:
  private static final String TAG_SUCCESS = "success";
  private static final String TAG_MESSAGE = "message";
  private static final String TAG_POSTS = "posts";
  private static final String TAG_EMAIL = "email";
  private static final String TAG_POSITION = "position";
  
  @SuppressLint("NewApi")
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_login);
      login = (Button) findViewById(R.id.login);
      register = (Button) findViewById(R.id.registerlauncher);
      email = (EditText) findViewById(R.id.userid);
      password = (EditText) findViewById(R.id.password);
  
      login.setOnClickListener(new View.OnClickListener() {
  
          @Override
          public void onClick(View v) {
              // TODO Auto-generated method stub
              String Username = email.getText().toString();
              String Password = password.getText().toString();
              new AttemptLogin(Username, Password).execute();
          }
      });
  
      register.setOnClickListener(new View.OnClickListener() {
  
          @Override
          public void onClick(View v) {
              // TODO Auto-generated method stub
              Intent intent = new Intent(Login.this, Register.class);
              startActivity(intent);
  
          }
      });
  
      if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.HONEYCOMB) {
          // For the main activity, make sure the app icon in the action bar
          // does not behave as a button
          getSupportActionBar().setDisplayHomeAsUpEnabled(true);
      }
  }
  
  public void onBackPressed() {
      Intent intent = new Intent(this, SplashScreen.class);
      intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
      intent.putExtra("EXIT", true);
      startActivity(intent);
              finish();
  }
  </code></pre>
  
  <p>I just don't know why After I Select Yes to Logout in <strong>MainMenu.java</strong> and it goes back to login page which is I want, But Once I reach Login Page, I press back again It will go back to main menu without having any logcat..</p>