What to use in Android API 28 now that fragments are deprecated
It's only native fragments that are being deprecated. Use the compatibility library fragments and all will be well. See this thread for more info about the difference between native and compatibility fragments. From the docs for android.app.fragment
:
This class was deprecated in API level 28.
Use the Support Library Fragment for consistent behavior across all devices and access to Lifecycle.
Meanwhile there's also androidx.fragment.app.Fragment
,
which will supersede the android.support.v4.app.Fragment
.