Quick question folks: I am developing an SDK where...
# android
u
Quick question folks: I am developing an SDK where I need to add Fragment into an Activity. FragmentManager is deprecated since API 26. Now get SupportFragmentManager is a function of support.AppCompatActivity. I don’t want to use deprecated class FragmentManager but can’t acces SupportFragmentManager from AppCompatActivity. What is the best way to go here?
😶 4
f
Use jetpack compose so you need to use fragments anyone
u
Thats not an option unfortunately
a
You can access supportFragmentManager using Context of an AppCompatActivity or casting a context as AppCompatActivity. Alternatively you can use childFragmentManager from inside of a fragment.
You can use this.supportFragmentManager or from inside of a fragment do requireContext().childFragmentManager