Skip to content Skip to sidebar Skip to footer

Fragmentpageradapter Always Load The Next Fragment Instead The Current

@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main_dictionary); getWindow().setSo

Solution 1:

its not a bug its the default functionality of a viewpager. for each nth page (n-1)th and (n+1)th page loads automatically with the nth page. I don't think there is any straight forward way to achieve what you want.

Solution 2:

The best way would be to use a custom onSwipeListener instead of ViewPager and load the fragment yourself..

But for ViewPager you can use a hack:

After saving data in fragment A,

    viewPager.setAdapter(adapter);

which will reload all fragments.

Don't forget to first save the current pager position. after reset, set pager position so you don't go back to the first position every time. not good coding but it should work.

Solution 3:

on your ViewPagerAdapter. override method : getItemPosition : return POSITION_NONE

Post a Comment for "Fragmentpageradapter Always Load The Next Fragment Instead The Current"