Skip to content Skip to sidebar Skip to footer

Findfragmentbytag() Returns Null Only On The Third Tab Of The Actiobar

I am using a tabbed Activity provided by Android with android.support.v7.app.ActionBar.TabListener,ViewPager and FragmentPagerAdapter. The parent Activty cointains and manages thre

Solution 1:

This is due to the third fragment not being created if only the first tab/fragment is shown. The ViewPager per default internally prepares the visible fragment, the one left to it and the one right to it. Try

viewpager.setOffscreenPageLimit(2)

Post a Comment for "Findfragmentbytag() Returns Null Only On The Third Tab Of The Actiobar"