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
florent
11/04/2021, 9:09 AM
Use jetpack compose so you need to use fragments anyone
u
_shtomar
11/04/2021, 10:11 PM
Thats not an option unfortunately
a
anotherstark
11/07/2021, 5:11 PM
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.
anotherstark
11/07/2021, 5:12 PM
You can use this.supportFragmentManager or from inside of a fragment do requireContext().childFragmentManager