Bonjour à toutes et à tous,

Voilà j'ai suivi ce lien: http://mathias-seguy.developpez.com/...oid/fragments/ pour fragmenter mon application (La partie VI-B)

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 public static void showFragment(int frameToReplace, String FragmentTAG, FragmentManager myFM) {
 
        FragmentTransaction ft = myFM.beginTransaction();
 
        fragmentToShow = myFM.findFragmentByTag(FragmentTAG);
 
        if (null == fragmentToShow) {
            fragmentToShow = createFragment(FragmentTAG);
            ft.replace(frameToReplace, fragmentToShow);
            Log.d("Fragment", "Le fragment " + FragmentTAG + " vient d'être crée !");
        } else {
            ft.show(fragmentToShow);
            Log.d("Fragment", "Le fragment " + FragmentTAG + " existait déjà !");
        }
 
        ft.addToBackStack(fragmentToShow.getTag());
 
        ft.commit();
    }
Le problème c'est que fragmentToShow est toujours null et je ne comprends pas pourquoi?

Est ce que j'oublie quelque chose?

Merci pour votre aide.