androidx.fragment.app.FragmentStatePagerAdapter is deprecated and developers are urged to switch to androidx.viewpager2.adapter.FragmentStateAdapter
How can we get the same functionality with FragmentStateAdapter that BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT provided?
This code below is now deprecated
FragmentStatePagerAdapter(
fragmentManager,
BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT
)
The ViewPager2's FragmentStateAdapter has the same functionality as BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT (this is, in fact, the only type of behavior ViewPager2 supports).
The ViewPager2 migration guide details the exact steps needed to convert to ViewPager2.