Getting deprecation warnings for androidx.fragment.app.Fragment
:
warning: [deprecation]
getFragmentManager()
inFragment
has been deprecated.
What to do?
Getting deprecation warnings for androidx.fragment.app.Fragment
:
warning: [deprecation]
getFragmentManager()
inFragment
has been deprecated.
What to do?
The sources of version 1.2.0
explain it in more detail:
This has been removed in favor of
getParentFragmentManager()
, which throws anIllegalStateException
if theFragmentManager
isnull
. Check ifisAdded()
returnsfalse
to determine if theFragmentManager
isnull
.
getParentFragmentManager()
instead of getFragmentManager()
or requireFragmentManager()
since both got deprecated in androidx.fragment.app.Fragement
–
Sultan In Kotlin:
fragmentManager
, requireFragmentManager()
are deprecated.
Current way: parentFragmentManager
In JAVA:
getFragmentManager()
, requireFragmentManager()
are deprecated.
Current way: getParentFragmentManager()
Deprecation of getFragmentManager():
The getFragmentManager() and requireFragmentManager() methods on Fragment have been deprecated and replaced with a single getParentFragmentManager() method, which returns the non-null FragmentManager the Fragment is added to (you can use isAdded() to determine if it is safe to call).
© 2022 - 2024 — McMap. All rights reserved.