Skip to content

Instantly share code, notes, and snippets.

@zawadz88
Created April 12, 2019 15:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zawadz88/9aa3c654737aa5b72dfb9a90ff816dcf to your computer and use it in GitHub Desktop.
Save zawadz88/9aa3c654737aa5b72dfb9a90ff816dcf to your computer and use it in GitHub Desktop.
class InjectingNavHostFragment : NavHostFragment() {
@Inject
protected lateinit var daggerFragmentInjectionFactory: InjectingFragmentFactory
override fun onAttach(context: Context) {
AndroidSupportInjection.inject(this)
super.onAttach(context)
}
override fun onCreate(savedInstanceState: Bundle?) {
childFragmentManager.fragmentFactory = daggerFragmentInjectionFactory
super.onCreate(savedInstanceState)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment