aurelhubert / aurelhubert/ahbottomnavigation
AHBottomNavigationViewPager goes blank when switching fragment multiple times
- Dominant language
- Java
- Stars
- 3.8k
- Forks
- 672
- PR merge metrics
- No merged PRs in 30d
Description
I'm using AHBottomNavigation and when I switch to a certain fragment multiple times I just get a blank screen. using this line:
viewPager.setCurrentItem(viewPagerIndex, false);
My FragmentPagerAdapter extends FragmentStatePagerAdapter. changing to FragmentPagerAdapter didn't help.
Changing viewPager.setOffscreenPageLimit(1-5); didn't help either.
Changing root layouts to FrameLayout didn't work.
I noticed many threads recommending using getChildFragmentManager instead of getSupportFragmentManager but this is not my case. I'm not using fragmentmanager inside a fragment just one activity.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing repeated fragment switches through AHBottomNavigationViewPager using viewPager.setCurrentItem(viewPagerIndex, false). Compare the reported FragmentStatePagerAdapter, FragmentPagerAdapter, and offscreen page limit configurations while observing when the screen becomes blank. Done means the affected fragment remains visible after switching to it multiple times.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100