I have a TabLayout and ViewPager in my android application. But when i use swipe for changing "Tab1" to "Tab2" and use click on "Tab1" to go back to first tab then fragment inside my viewpager is not updated.
Similar problem exist if i use swipe to move from "Tab2" to "Tab3" and then try to click on tab to move back to Tab2.
Otherwise the TabLayout works fine all tabs will be updated and proper fragments are shown if i use any other combination of swipes or clicks.
//set tabs and viewpager
ViewPager viewPager = (ViewPager) findViewById(R.id.mViewPager);
viewPager.setAdapter(new MyFragmentPageAdapter(getSupportFragmentManager(), MainActivity.this));
//layout
TabLayout tabLayout= (TabLayout) findViewById(R.id.mTabs);
tabLayout.setupWithViewPager(viewPager);