You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In your post here(http://fernandocejas.com/2015/04/11/tasting-dagger-2-on-android/),
I see the following method in ApplicationModule class but the actual github code doesn't have this method. But what is weird is, this runs even without it.
Can you explain how so? Thanks!
@provides@singleton Navigator provideNavigator() {
return new Navigator();
}
The text was updated successfully, but these errors were encountered:
It is the same reason why presenters are not provided.
Most of the time you use injection by constructor to satisfy the dependencies in dagger 2.
Here we used:
@Inject
public Navigator() {}
to tell Dagger to use the constructor to create instances of Navigator.
You only need provide-methods, if dagger doesn't know how to construct the object. That's when you use third-party classes or you use an interface and dagger doesn't know which implementation it should use.
The explanation in the article is wrong. So only use modules for interfaces, third-party classes and objects which need to be configured. Less code, less bugs.
@ehdtkqorl123 the code is being refactor and it is very hard to keep everything up to date, specially because of the lack of time. That is why we are trying to have discussions here and find the best way to address the different problems we come across with.
In your post here(http://fernandocejas.com/2015/04/11/tasting-dagger-2-on-android/),
I see the following method in ApplicationModule class but the actual github code doesn't have this method. But what is weird is, this runs even without it.
Can you explain how so? Thanks!
@provides @singleton Navigator provideNavigator() {
return new Navigator();
}
The text was updated successfully, but these errors were encountered: