onSaveInstanceState() not called: why?
<p><strong>Problem:</strong></p>

<p>I add a fragment to a LinearLayout, programmatically. It shows up in my activity, great. 
I turn the device —> configuration changes: everything is destroyed to be recreated. But, before onDestroy() is called, onSaveInstanceState() should be called. It is the case for the parent activity, but not for the fragment I've added. Why ?</p>

<p><strong>Code:</strong></p>

<p>The XML:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@id/parent_LL"
android:stuff="myStuff"
&gt;

&lt;LinearLayout
    android:id="@id/categories_activity_LL1"
    android:stuff="myStuff" /&gt;

&lt;LinearLayout
    android:id="@id/categories_activity_LL2"
    android:stuff="myStuff" /&gt;
&lt;/LinearLayout&gt;
</code></pre>

<p>I add the fragment to the UI in the parent activity:</p>

<pre><code>ft.add(container1, categories, CatFragIds.CATEGORIES.toString()).commit();
</code></pre>

<p>I override the onSaveInstanceState() of my fragment:</p>

<pre><code>@Override
public void onSaveInstanceState(Bundle outState) {

    // Récupère extensible
    boolean extensible = ((CategoryAppsListView) this.getListView())
    .isExtensible();

    mState.setExtensible(extensible);

    // Transmet l'état de CategoriesListElems
    FragmentManager fm = getFragmentManager();

    @SuppressWarnings("unchecked")
    FragRetainObject&lt;CategoriesListElemsState&gt; retainedState = 
    (FragRetainObject&lt;CategoriesListElemsState&gt;)
    fm.findFragmentByTag(CATEGORIESLISTELEMS_STATE+"_"+this.getTag());

    if( retainedState == null) {
        retainedState = 
        FragRetainObject.&lt;CategoriesListElemsState&gt;newInstance(mState);

        fm.beginTransaction()
        .add(retainedState, CATEGORIESLISTELEMS_STATE+"_"+this.getTag()).commit();
    }
    else retainedState.setRetainObj(mState);

    super.onSaveInstanceState(outState);
}
</code></pre>

<p>Thank you for your time!! :-)</p>
