title: Injecting field into module using dagger
body: <p>I am trying to inject my android context from one module into another. This is my code so far:</p>
  
  <p>UserProfileModule.java</p>
  
  <pre><code>@Module(
          library = true
  )
  public class UserProfileModule {
  
      @Inject Context _context;
  
      @Provides
      public AccountUtils.UserProfile provideUserProfile() {
          return AccountUtils.getUserProfile(_context);
      }
  }
  </code></pre>
  
  <p>RootModule.java</p>
  
  <pre><code>@Module(
          injects = {
                  PizzaApplication.class,
                  UserProfileModule.class,
                  MainActivity.class
          },
          includes = {
                  UserProfileModule.class
          },
          library = true
  )
  
  public class RootModule {
      private final Context _context;
  
      public RootModule(Context context) {
          _context = context;
      }
  
      @Provides
      @Singleton
      public Context provideApplicationContext() {
          return _context;
      }
  }
  </code></pre>
  
  <p>Anytime it tries to get the user profile it fails saying the object is null.]</p>
  
  <p>EDIT:</p>
  
  <p>PizzaApplication.java</p>
  
  <pre><code>public class PizzaApplication extends Application {
      private ObjectGraph objectGraph;
  
      @Override
      public void onCreate() {
          super.onCreate();
          injectDependencies();
      }
  
      private void injectDependencies() {
          objectGraph = ObjectGraph.create(new RootModule(this));
          objectGraph.inject(this);
      }
  
      public void inject(Object object) {
          objectGraph.inject(object);
      }
  }
  </code></pre>
  
  <p>MainActivity.java</p>
  
  <pre><code>public class MainActivity extends BaseActivity {
  
      @InjectView(R.id.toolbar) public Toolbar _toolbar;
      @InjectView(R.id.drawer) public DrawerFrameLayout _drawer;
      @Inject public AccountUtils.UserProfile _profile;
      @Inject public Context _context;
  
      // private NavigationDrawerFragment navigationDrawerFragment;
  
      @Override
      protected void onCreate(Bundle saveInstanceState) {
  </code></pre>