I have migrated from ViewPager to ViewPager2
Official guide & blog are helpful.
But I found that my code working in one of the pages (Fragment) of the ViewPage