Android RecyclerView which is in a Fragment which is in a ViewPager does not reload/refresh views if setOffscreenPageLimit is reached -
i have recyclerview
in fragment
again in viewpager
, when swipe between viewpager
pages, see ondetach
of fragment
being called reason recyclerview
still present in particular position fragment
in viewpager
, scroll position of recyclerview
being preserved when come detached fragment.
i using fragmentstatepageradapter
viewpager
, returning position_none
getitemposition()
has no effect.
please me understand problem here.
try points.
1) myadapter extends fragmentstatepageradapter
2) set adapter fragment using getchildfragmentmanager()
eg : mviewpager.setadapter(new myadapter(getchildfragmentmanager(), getactivity(), this))
3) viewpagerfrgment override
setuservisiblehint
method
@override public void setuservisiblehint(boolean isvisibletouser) { super.setuservisiblehint(isvisibletouser); if (isvisibletouser) { //update recyclerview } else { } }
Comments
Post a Comment