Skip to content

Instantly share code, notes, and snippets.

@cribetti
Last active March 12, 2020 15:41
Show Gist options
  • Save cribetti/b649f92424fbd5b6abe88244d5eb71f2 to your computer and use it in GitHub Desktop.
Save cribetti/b649f92424fbd5b6abe88244d5eb71f2 to your computer and use it in GitHub Desktop.
class FragmentFactoryImpl: FragmentFactory() {
val arg = "my argument"
override fun instantiate(classLoader: ClassLoader, className: String): Fragment {
return when (className) {
MyFragment::class.java.name -> MyFragment(arg)
else -> super.instantiate(classLoader, className)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment