iammert / dagger-android-injection Goto Github PK
View Code? Open in Web Editor NEWSample project explains Dependency Injection in Android using dagger-android framework.
Sample project explains Dependency Injection in Android using dagger-android framework.
Hey,
thank you for your great tutorials.
I have a problem with adding a NetworkModule
I don't know should i add a NetworkComponnet too or not
and NetworkModule contains @Singelton .
and should i add NetworkModule or NetworkComponent to AppComponent ?
I'm confused... please help me.
Thank you.
Hi, thanks for an amazing example, I have a question about two lines in the AppComponent.java, see below, what is the purpose of these lines? without these lines the app seems to work fine
void inject(AndroidSampleApp app);
@Override
void inject(DaggerApplication instance);
I came across with your excellent explanation about the New Android Injector with Android 2. As a matter of fact, I suggest creating a branch with a Kotlin version, so that developers could integrate dagger 2.11+ to their Android app developer with Kotlin.
can't find class DaggerAppComponent
How does MainActivityComponent
get a MainActivity context?
We can use @BindsInstance
method in inner Builder interface in MainActivityComponent
(Subcomponent) and specify MainActivity
(or Context) as parameter or just send MainActivity's Context in constructor of MainActvityModule.
But I can not find where in your sample app you send the MainActivity's context. Could you explain me, please?
You're providing the presenter via
https://github.com/iammert/dagger-android-injection/blob/dagger-simplified-with-contributes/app/src/main/java/iammert/com/dagger_android_injection/ui/detail/DetailActivityModule.java#L18
while having the @Inject
annotation in the constructor, any reason?
@Provides
MainPresenter provideMainPresenter(MainView mainView, ApiService apiService){
return new MainPresenterImpl(mainView, apiService);
}
I don't find any Inject of mainView, Where could Dagger2 to find it and then to provide MainPresenter?
I want to add some modules to fragment binder. For example,
@ContributesAndroidInjector(modules = {RoomModule.class, RestServiceModule.class, UtilsModule.class}) abstract WatchedMoviesFragment provideWatchedMoviesFragmentFactory();
But I need to write setters for this modules. Where should I do that?
Error: @Subcomponent.Builder is missing setters for required modules or subcomponents: [xx.RoomModule, xx.UtilsModule]
Hey,
How to use dagger android version in multi modular project. Because according to the structure we should have access to Activity module in app component that is in app module.
But the app module do not implements the different feature module in which my modules will be written.
Thanks,
Amanjeet
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.