Why is my program not showing 2nd Tab content?

I have tried this countless times, I even installed VS 2017 hoping that VS 2019 had some fundamental fault somewhere. But in every case I hit the wall. I have provided all of my code at Github and the link is: https://github.com/ahmar20/com.aa.streetmedia.

The problem is that I am trying to reuse my layout files so every layout is being included at the run-time or inflated only when needed and I am using Fragments through ViewPager and TabLayout and it's not working. I am trying to create 2 tabs in the main activity and only first one shows the data for the 2nd tab and 2nd tab does not show any data. I don't understand what is happening because if I switch the tab adding lines it's still the same with other way around.

I add the tabs in the MainActivity in SetupTabs(ViewPager pager) function. Please note this is only for learning purposes.
This is where I add the tabs:

            tabsAdapter.AddTab(new TitleFragment() { Title = "New Episodes", Fragment = new CustomFragment(DataEnum.MainTabsType.NewEpisodes) });
            tabsAdapter.AddTab(new TitleFragment() { Title = "Popular Shows", Fragment = new CustomFragment(DataEnum.MainTabsType.PopularShows) });

Best Answer


Sign In or Register to comment.