Skip to content

Instantly share code, notes, and snippets.

@rachitmishra
Last active November 7, 2017 19:12
Show Gist options
  • Save rachitmishra/aa49c894ae539c2babded2dc5206f829 to your computer and use it in GitHub Desktop.
Save rachitmishra/aa49c894ae539c2babded2dc5206f829 to your computer and use it in GitHub Desktop.
/**
* 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