FragmentStatePagerAdapter IllegalStateException: <MyFragment> n'est pas actuellement dans la FragmentManager

Je reçois ce sur certains cas, dans onResume(), d'une activité qui utilise un FragmentStatePagerAdapter. Lors de l'utilisation de l'appareil touche retour. Pas toujours. Pas reproductible.

Je suis d'utilisation d'un support package v4, la dernière révision (8).

Déjà cherché avec google, sans succès, de trouver une réponse utile.

À la recherche de la source, il est lancé ici: FragmentManager.java

@Override
public void putFragment(Bundle bundle, String key, Fragment fragment) {
    if (fragment.mIndex < 0) {
        throw new IllegalStateException("Fragment " + fragment
                + " is not currently in the FragmentManager");
    }
    bundle.putInt(key, fragment.mIndex);
}

Mais pourquoi l'indice de fragment < 0 il?

Le code de l'instanciation de l'fragments:

@Override
public Fragment getItem(int position) {
    Fragment fragment = null;

    switch(position) {
        case 0:
            fragment = MyFragment.newInstance(param1);
            break;
        case 1:
            fragment = MyFragment2.newInstance(param2, param3);
            break;
    }
    return fragment;
}

@Override
public int getCount() {
    return 2;
}
InformationsquelleAutor Ixx | 2012-07-02