androidx.fragment.app.fragmentstatepageradapter deprecated

https://developer.android.com/reference/androidx/fragment/app/FragmentStatePagerAdapter.html#FragmentStatePagerAdapter(androidx.fragment.app.FragmentManager)

Recently the androidx.fragment.app.FragmentManager is deprecated
It is not deprecated at the present time. For example, it is not marked as deprecated in the documentation.

'FragmentStatePagerAdapter(androidx.fragment.app.FragmentManager)' is deprecated
The single-parameter FragmentStatePagerAdapter constructor is deprecated. However, if you read the documentation for that constructor, you will find:
This constructor is deprecated.
use FragmentStatePagerAdapter(FragmentManager, int) with BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT

So, replace FragmentStatePagerAdapter(fm) with FragmentStatePagerAdapter(fm, FragmentStatePagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT), to retain the functionality from the original one-parameter constructor.

No comments:

Post a Comment

Popular Posts