title: In Android, how can I detect why my activity was resumed?
body: <p>I'm developing an Activity that does some of its own state management.  I'm trying to differentiate the following onResume cases:</p>
  
  <ol>
  <li>New launch</li>
  <li>task switch (home button long-click)</li>
  <li>resume after other activity in the same application</li>
  <li>wake-up after sleep</li>
  <li>orientation change</li>
  </ol>
  
  <p>Is there something in the Activity's intent, or elsewhere, that can help me differentiate these?</p>
  
  <p>For the curious and some context... I'd like to preserve my internal history stack on 4 &amp; 5.  On cases 2 &amp; 3, I would preserve the same current page, but erase the history (allow the normal back button functionality to take over at that point).  Case 1 would initialize to the activity's internal start page (and can be detected easily enough with some help from onCreate).</p>