Skip to content

Instantly share code, notes, and snippets.

@Leviaran
Created February 5, 2021 06:44
Show Gist options
  • Save Leviaran/44821db5d7398cffe190b2096262e4da to your computer and use it in GitHub Desktop.
Save Leviaran/44821db5d7398cffe190b2096262e4da to your computer and use it in GitHub Desktop.
class MyFragmentFactory (
private val requestService: RequestService
) : FragmentFactory() {
override fun instantiate(classLoader: ClassLoader, className: String): Fragment { ... }
}
// Your Activity
class MainActivity : AppCompatActivity() {
@Inject
lateinit var fragmentFactory: MyFragmentFactory
override fun onCreate(savedInstanceState: Bundle?) {
supportFragmentManager.fragmentFactory = fragmentFactory
super.onCreate(savedInstanceState)
...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment