Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save cribetti/e5100b272a4fcf4b5a4cab972606e2dc to your computer and use it in GitHub Desktop.
Save cribetti/e5100b272a4fcf4b5a4cab972606e2dc to your computer and use it in GitHub Desktop.
class MyActivity() : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
supportFragmentManager.fragmentFactory = FragmentFactoryImpl()
super.onCreate(savedInstanceState)
...
val fragment = supportFragmentManager.fragmentFactory.instantiate(classLoader, MyFragment::class.java.name)
supportFragmentManager.beginTransaction()
.replace(R.id.fragment_layout, fragment)
.commitNow()
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment