title: Android Actionbar Up button versus system Back button
body: <p>I'm using the Actionbar and it's "up" button to return from a detail activity to the main activity, which works fine. Similarly, the user can press the system "back" button to return to the main activity.</p>
  
  <p>In my main activity, in <code>onCreate()</code> data is downloaded from the internet to display upon app start. I noticed that when I use the Actionbar "up" button to go from detail to main activity, <code>onCreate()</code> is run, re-downloading the data. But <code>onCreate()</code> is not run when I use the system "back" button, therefore immediately showing the main activity view.</p>
  
  <p>The code I use in the detail activity to implement the "up" button is:</p>
  
  <pre><code>switch (item.getItemId()) {
     case android.R.id.home:
        Intent intent = new Intent(this, MainActivity.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        startActivity(intent);
        return true;
  </code></pre>
  
  <p>I would like the "up" button to behave like the "back" button and not rerun <code>onCreate()</code>. But I'm unsure how to make this happen, or which code path the "back" button implements to return to the main activity.</p>
  
  <p>Thanks!</p>