title: activity not calling onDestroy() after finish()
body: <p>I have three activities, let's call them ONE, TWO and THREE. From activity ONE, a button press starts activity TWO. From activity TWO, a button press starts activity THREE.</p>
  
  <p>Simple enough.</p>
  
  <p>Now, activity THREE requires a bit of data accessible from the application (which may or may not be there). In THREE's <code>onResume()</code> method, a check is made for the data and the activity is finished if it doesn't exist, like so:</p>
  
  <pre><code>@Override
  protected void onResume() {
      super.onResume();
  
      /* ... get data from app ... */
  
      if (data == null) {
          Toast.makeText(this, "Data not found", Toast.LENGTH_SHORT).show();
          finish();
          return;
      }
  
      /* ... other logic ... */
  }
  </code></pre>
  
  <p>When <code>data == null</code>, THREE finishes, destroys and returns to TWO. All is well.
  Now in TWO, pressing the back button calls <code>finish()</code> on TWO, but TWO never calls <code>onDestroy()</code>. The user is returned to ONE just fine, but any subsequent intent to go back to TWO does not work and no errors are thrown. TWO is left in a state where it has been finished (and paused), but never destroyed, and as a result cannot resume.</p>
  
  <p>So, why is THREE important in this case? If I remove the <code>finish()</code> call in the code block above, and rely on a "natural" finishing of THREE (by using the back button), when the user gets back to ONE, TWO has been destroyed correctly.</p>
  
  <p>OK here's where it gets really confusing...</p>
  
  <p>Leaving the <code>finish()</code> call in place, I can alleviate the hangup by launching THREE directly from ONE, then "naturally" finish it (back button). After THREE is destroyed (a second time), TWO opens as expected.</p>
  
  <p>Everything I've read has said I should be ok calling <code>finish()</code> within <code>onResume()</code> for an activity. But in this case, it is leaving something in a bad state and prevents me from destroying the calling activity down the line.</p>
  
  <p>Ideas? or did I turn your brains inside out?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Further exploration uncovered this gem...</p>
  
  <p>Surrounding the <code>finish()</code> call in THREE with a <code>postDelay()</code> handler of around 500 millis will allow TWO to close as expected. Like this:</p>
  
  <pre><code>@Override
  protected void onResume() {
      super.onResume();
  
      /* ... get data from app ... */
  
      if (data == null) {
          Toast.makeText(this, "Data not found", Toast.LENGTH_SHORT).show();
          Handler h = new Handler();
          h.postDelayed(new Runnable() {
              @Override
              public void run() {
                  finish();
              }
          }, 500);
          return;
      }
  
      /* ... other logic ... */
  }
  </code></pre>
  
  <p>Not exactly my idea of a fix...</p>