I'm struggling to allow the users to leave my app using the back button after logout.
My HomeActivity checks that the user has a sessionID. if they don't it will redirect them to the login page. upon successful login the homepage is displayed showing the sessionID and a logout button.
Clicking on the button removes the session ID and displays a message to the user to that effect. Pressing the back button at this point takes the user to the login page, and I can't get off it by pressing back - I can login and press back to leave the app, but I can't quit using the back button after logout.
Any Ideas?
HomeActivity
public class HomeActivity extends Activity {
protected void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
}
protected void onStart(){
    super.onStart();
    /*
     * Check if a session ID exists - if it does then display the home screen 
     * If the session ID does not exist then redirect the user to the login page.
     */
    String sessionId = Session.getSessionId(getApplicationContext());
    if (StringUtils.isBlank(sessionId)){
        navigateToLoginActivity();
    }
    // Display the Home Screen
    setContentView(R.layout.home);
    TextView tv = (TextView)findViewById(R.id.welcome);
    tv.setText(sessionId);
}
public void logout(View view){
    navigateToLogoutActivity();
}
public void navigateToLoginActivity(){
    Intent loginIntent = new Intent(getApplicationContext(),LoginActivity.class);
    loginIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    startActivity(loginIntent);
}
public void navigateToLogoutActivity(){
    Intent logoutIntent = new Intent(getApplicationContext(),LogoutActivity.class);
    logoutIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    startActivity(logoutIntent);
}
}
LoginActivity
public class LoginActivity extends Activity {
EditText nfcET;
protected void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    setContentView(R.layout.login);
    nfcET = (EditText)findViewById(R.id.nfckey);
}
public void login(View view){
    String nfckey = nfcET.getText().toString();
    RequestParams params = new RequestParams();
    params.put("nfckey", nfckey);
    invokeWS(params);
}
public void invokeWS(RequestParams params){
   // REMOVED WEBSERVICE CODE - calls webservice and retrieves a sessionID which is saved in a SharedPreference, it calls navigateToHomeActivity upon successful login
}
public void navigatetoHomeActivity(){
    Intent homeIntent = new Intent(getApplicationContext(),HomeActivity.class);
    homeIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    startActivity(homeIntent);
}
}
LogoutActivity
public class LogoutActivity extends Activity{
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Session.removeSessionId(getApplicationContext());
        if (!StringUtils.isBlank(Session.getSessionId(getApplicationContext()))){
            //TODO - Handle the case that the session was not removed!
        } else {
            setContentView(R.layout.logout);
        }
    }
}
 
     
    