Skip to content

Instantly share code, notes, and snippets.

@diousk
Last active February 1, 2020 09:12
Show Gist options
  • Save diousk/c8e8647212b82052457788951143207e to your computer and use it in GitHub Desktop.
Save diousk/c8e8647212b82052457788951143207e to your computer and use it in GitHub Desktop.
launch fragment with fragment factory
class MainActivity: FragmentInjectActivity() {
@Inject lateinit var fragmentFactory: FragmentFactory
override fun onCreate(savedInstanceState: Bundle?) {
supportFragmentManager.fragmentFactory = fragmentFactory
super.onCreate(savedInstanceState)
// launch fragment and add to fragmen container view
supportFragmentManager.beginTransaction()
.add<DummyFragment>(R.id.fragmentContainer)
.commit()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment