I'm using BottomNavigationView
to navigate between two Fragments, on of these fragments has its own ViewPager
with TabLayout
as below:
This is what i'm trying to do:
MainActivity
|--- HomeFragment
| |--- POPULAR
| |--- LATEST
| |--- TOP RATED
| |--- UPCOMING
|--- FavoritesFragment
it works fine while swiping the ViewPager
, the problem occures when i'm in LATEST
or TOP RATED
and navigates the BottomNavigationView
to FavoritesFragment
and return back to HomeFragment
, the ViewPager
starts over from POPULAR
not the fragment i was in before navigation.
How can i avoid this tricky navigation problem?
And what is the best solution to keep track of navigation in such situation?