title: ActionBar up navigation recreates parent activity instead of onResume
body: <p>I'm using the recommended approach for <a href="http://developer.android.com/training/implementing-navigation/ancestral.html" rel="noreferrer">Up Navigation</a> and my code looks like this: </p>
  
  <pre><code>@Override
  public boolean onOptionsItemSelected(MenuItem item) {
      switch (item.getItemId()) {
          case android.R.id.home:
              Intent h = new Intent(ShowDetailsActivity.this, MainActivity.class);
              h.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
              startActivity(h);
              return true;
          default: return super.onOptionsItemSelected(item);
      }
  }
  </code></pre>
  
  <p>Here's the use-case: </p>
  
  <ol>
  <li>I launch my app which is "MainActivity"</li>
  <li>I click a button to go to "ShowDetailsActivity"</li>
  <li>I click on the UP ActionBar navigation</li>
  </ol>
  
  <p>The issue is after I click on UP, MainActivity hits its onCreate() methods all over again and loses all state instead of starting at the typical onResume() like it would if I just called "finish()" from ShowDetailsActivity. Why? Is this how it always works and this is expected behavior for Android to recreate all activities that are navigated to using the "Up" navigation approach? If I hit the back button I get the expected onResume lifecycle. </p>
  
  <p>This is my solution if an Android "proper" ones doesn't exist: </p>
  
  <pre><code>@Override
  public boolean onOptionsItemSelected(MenuItem item) {
      switch (item.getItemId()) {
          case android.R.id.home:
              Intent upIntent = new Intent(this, MainActivity.class);
              if (NavUtils.shouldUpRecreateTask(this, upIntent)) {
                  NavUtils.navigateUpTo(this, upIntent);
                  finish();
              } else {
                  finish();
              }
              return true;
          default: return super.onOptionsItemSelected(item);
      }
  }
  </code></pre>