title: Android Fragment being destroyed yet receiving onActivityResult
body: <p>thanks to this answer <a href="https://stackoverflow.com/questions/23246284/android-fragment-lifecycle-issue-nullpointerexception-on-onactivityresult">Android Fragment lifecycle issue (NullPointerException on onActivityResult)</a> I've managed to re-create a scenario when I receive a NPE in my fragment after calling startActivityForResult.
  So i have</p>
  
  <pre><code>Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);
  photoPickerIntent.setType("image/*");
  startActivityForResult(photoPickerIntent, PHOTO_SELECT_REQUEST_CODE);
  break;
  </code></pre>
  
  <p>being called from my fragment, then my activity receives onPause, onStop and onDestroy, so the fragment that called <code>startActivityForResult</code> gets an onDestroy as well. After I pick an image, i get a new onCreate on my activity and then i get a <code>public void onActivityResult</code> on my original fragment that is now destroyed.</p>
  
  <p>My question is since this is potentially (albeit a rare) situation, how would one restore the entire stack of fragments and objects passed to them and what does one do to prevent the original fragment from leaking?</p>