문제

I am using fragmentpageadapter for pager and i wan to reload the particular fragment with new set of values. NotifyDataSetcanged is reloading all fragments and i am using this line of code as well

 public int getItemPosition(Object object) {
       return POSITION_NONE;
    }
도움이 되었습니까?

해결책

I was having the same problem. All my fragments were being refreshed and being forced to call onCreate() which was messing up my data.

The getItemPosition() method seemed to be called for each fragment in the adapter. I found if I set an IF statement to catch the fragment that I didn't want refreshed and I returned POSITION_UNCHANGED it would not refresh that fragment

Using this method you should be able to refresh only the fragment(s) you want to.

if (object.getClass().getName().equals(NonUpdatingFragment.class.getName()))
{
    return POSITION_UNCHANGED;
}
else
{
    return POSITION_NONE;
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top