title: Failure saving state - target not in fragment manager (setTargetFragment)
body: <p>I've got a monkey crash whereby </p>
  
  <pre><code>java.lang.IllegalStateException: Failure saving state: FragmentB has target not in fragment manager: FragmentA
  at android.support.v4.app.FragmentManagerImpl.saveAllState(FragmentManager.java:1561)
  at android.support.v4.app.FragmentActivity.onSaveInstanceState(FragmentActivity.java:475)
  at com.acme.ParentActivity.onSaveInstanceState(Unknown Source)
  </code></pre>
  
  <p>Basically FragmentA loads up FragmentB and <code>setTargetFragment</code> is called to set FragmentB's target fragment. </p>
  
  <p>FragmentB then simply calls <code>getTargetFragment</code>in its <code>onCreate</code> method and hangs on to the target for when needed. </p>
  
  <p>Now I'm not doing anything in any of the <code>onSaveInstanceState</code> calls with the target fragment in terms of setting it null, making any <code>saveFragmentInstanceState</code>, <code>putFragment</code> etc. calls. The question is should I be doing something with it?</p>
  
  <p>Thanks in advance,</p>
  
  <p>Peter.</p>
  
  <p>** Edit 1 **
  I am using an old version of the support library and have a feeling that this may be fixed in the latest version, will test further and provide a further update if that is the case. However, still interested to know whether I should be doing anything with the target fragment that I'm not currently doing.</p>
  
  <p>** Edit 1 ** Fixed with version 8 of the support library (haven't tried others).</p>