src/main/java/com/fizzbuzz/android/dagger/InjectingFragment.java
@Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);

        // expand the activity graph with the fragment-specific module(s)
        ObjectGraph appGraph = ((Injector) activity).getObjectGraph();
        List<Object> fragmentModules = getModules();
        mObjectGraph = appGraph.plus(fragmentModules.toArray());

        // make sure it's the first time through; we don't want to re-inject a retained fragment that is going
        // through a detach/attach sequence.
        if (mFirstAttach) {
            inject(this);
            mFirstAttach = false;
        }
    }
@Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);

        // expand the activity graph with the fragment-specific module(s)
        ObjectGraph appGraph = ((Injector) activity).getObjectGraph();
        List<Object> fragmentModules = getModules();
        mObjectGraph = appGraph.plus(fragmentModules.toArray());

        // make sure it's the first time through; we don't want to re-inject a retained fragment that is going
        // through a detach/attach sequence.
        if (mFirstAttach) {
            inject(this);
            mFirstAttach = false;
        }
    }
@ Override public void onAttach ( Activity activity ) { super . onAttach ( activity ) ; // expand the activity graph with the fragment-specific module(s) ObjectGraph appGraph = ( ( Injector ) activity ) . getObjectGraph ( ) ; List < Object > fragmentModules = getModules ( ) ; mObjectGraph = appGraph . plus ( fragmentModules . toArray ( ) ) ; // make sure it's the first time through; we don't want to re-inject a retained fragment that is going // through a detach/attach sequence. if ( mFirstAttach ) { inject ( this ) ; mFirstAttach = false ; } }
Creates an object graph for this Fragment by extending the hosting Activity's object graph with the modules
returned by {@link #getModules()}.
<p/>
Injects this Fragment using the created graph.
Creates an object graph for this Fragment by extending the hosting Activity s object graph with the modules returned by {