Created
April 25, 2017 07:24
-
-
Save josh-burton/68f842d3d00ca770b4a85b40c0e1c995 to your computer and use it in GitHub Desktop.
Context with @BindsInstance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DaggerApplicationComponent.builder().context(applicationContext).build().inject(this); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component(modules = {Module.class}) | |
public interface Component { | |
@Component.Builder | |
interface Builder { | |
@BindsInstance | |
Builder context(Context context); | |
Component build(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Module | |
abstract class ApplicationModule { | |
@Provides | |
public static Dependency provideDependencyNeedingContext(Context context) { | |
//create dependency | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment