How can I provide activity context with Dagger dependecies? : <p><strong>How can I provide activity context in mainModule class ? Thanks!</strong> The code looks like this:</p>

<pre><code>    @Singleton
@Component(modules = {AndroidInjectionModule.class, AppModule.class, ActivityBuilder.class})
public interface AppComponent {

    @Component.Builder
    interface Builder {

        @BindsInstance
        Builder application(Application application);

        AppComponent build();

    }

    void inject(MvmApp app);
}
</code></pre>

<p>Activtity builder:</p>

<pre><code>@Module
public abstract class ActivityBuilder {

    @ContributesAndroidInjector(modules = {MainModule.class})
    abstract MainActivity bindMainActivity();
}
</code></pre>

<p>And I have an appModule, and a module for each activity:</p>

<pre><code>@Module
public class AppModule {

    @Provides
    @Singleton
    @ApplicationContext
    Context provideContext(Application application) {
        return application;
    }

    @Provides
    @Singleton
    DataManager provideDataManager(AppDataManager appDataManager) {
        return appDataManager;
    }

    @Provides
    @DatabaseInfo
    String provideDatabaseName() {
        return "carDatabase";
    }

    @Provides
    @Singleton
    AppDataBase provideAppDatabase(@DatabaseInfo String dbName, @ApplicationContext Context context) {
        return Room.databaseBuilder(context, AppDataBase.class, dbName)
                .build();
    }

    @Provides
    @Singleton
    DbHelper provideDbHelper(AppDbHelper appDbHelper) {
        return appDbHelper;
    }
}
</code></pre>

<p>AppClass:</p>

<pre><code>public class MvmApp extends Application implements HasActivityInjector {

    @Inject
    DispatchingAndroidInjector&lt;Activity&gt; activityDispatchingAndroidInjector;

    @Override
    public void onCreate() {
        super.onCreate();

        DaggerAppComponent.builder()
                .application(this)
                .build()
                .inject(this);

    }

    @Override
    public DispatchingAndroidInjector&lt;Activity&gt; activityInjector() {
        return activityDispatchingAndroidInjector;
    }
}
</code></pre>

<p>All my activities extends a base activity which inject the Dagger dependecies.</p>

<pre><code>public abstract class BaseActivity extends AppCompatActivity implements MvpView {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        AndroidInjection.inject(this);

    }
}
</code></pre>

<p><strong><em>In mainModule I need to provide the context of the activity.</em></strong></p>

<pre><code>@Module
public class MainModule {

    @Provides
    MainMvpPresenter&lt;MainMvpView&gt; provideMainPresenter(
            MainPresenter&lt;MainMvpView&gt; presenter) {
        return presenter;
    }



    @Provides
    CompositeDisposable provideCompositeDisposable() {
        return new CompositeDisposable();
    }

    @Provides
    CarAdapter provideCarAdapter( @ActivityContext Context context) {
        return new CarAdapter(context);
    }

}
</code></pre>
