I'm using a tabLayout within a parent fragment to provide 5 child fragments to the user. I'm trying to migrate this from ViewPager to ViewPager2.
The issue is that child fragment 0 and 2 are loading, but the other 3 are blank. Using the debugger I found out that the fragment's onCreate is being called, but it seems like the fragments are instantly detached again.
If I connect the layout inspector it works.
I also tried ViewPager version 1.0.0 and Beta 1.1.0
All the child fragments used to load using ViewPager without any problem, therefore I think this is a ViewPager2 issue and not an issue of my child fragments.
I'm using a tabLayout within a parent fragment to provide 5 child fragments to the user. I'm trying to migrate this from ViewPager to ViewPager2.
The issue is that child fragment 0 and 2 are loading, but the other 3 are blank. Using the debugger I found out that the fragment's
onCreate
is being called, but it seems like the fragments are instantly detached again.If I connect the layout inspector it works.
I also tried ViewPager version 1.0.0 and Beta 1.1.0
All the child fragments used to load using ViewPager without any problem, therefore I think this is a ViewPager2 issue and not an issue of my child fragments.
ParentFragment:
TabAdapter:
Fragment loaded:![Screenshot_20230214-192324](https://user-images.githubusercontent.com/60486125/219084994-93401b45-6505-4649-aa49-b149b28ec078.png)
Fragment hasn't loaded:![Screenshot_20230214-192327](https://user-images.githubusercontent.com/60486125/219084989-27739208-8628-49a5-875c-df80f57b43e9.png)