Last active
November 7, 2017 19:12
-
-
Save rachitmishra/aa49c894ae539c2babded2dc5206f829 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/** | |
* Activity handling it's injection | |
*/ | |
class MyActivity { | |
@Inject | |
lateinit var computer: Computer // Requesting the dependency | |
override fun onCreate(savedInstanceState: Bundle?) { | |
(application as MyApplication).computerComponent.inject(application) // Injecting using `ComputerComponent` initialised in application class | |
super.onCreate(savedInstanceState) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment