Android prevent back stack from being cleared when home button is pushed
<p>My home button is clearing the back stack. So that when the user re-enters the application and pushes the back button (soft or hard) it quits the app instead of returning to the activity at the top of the back stack.</p>

<p>I have alwaysRetainTaskState set to true, and nothing else has been overriden. Why is this happening? How to stop it from being cleared!!</p>

<pre><code>@Override
    public boolean onOptionsItemSelected(MenuItem item) {
        Intent intent;
        switch (item.getItemId()) {
        case android.R.id.home:
            activity.finish();
            return true;
        case R.id.menu_paymentLocs:
            intent = new Intent(activity, PaymentLocationsPage.class);
            intent.addFlags(Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP);
            activity.startActivity(intent);
            return true;
        case R.id.menu_feedback:
            intent = new Intent(activity, FeedbackPage.class);
            intent.addFlags(Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP);
            activity.startActivity(intent);
            return true;
        case R.id.menu_about:
            intent = new Intent(activity, AboutPage.class);
            intent.addFlags(Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP);
            activity.startActivity(intent);
            return true;
        case R.id.menu_changeconsumer:
            new SelectConsumerDialogFragment().show(getFragmentManager(), "select_consumer");
            return true;
        case R.id.menu_logout:
            intent = new Intent(activity, SplashPage.class);
            myMeter.logout();
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
            activity.startActivity(intent);
            return true;
        }
        return true;
    }
</code></pre>
