Q:

Can't make FragmentPagerAdapter to update Fragments contents

I am trying to update the data passed to my adapter and hence update Fragments whose contents depends on these data, 
here is the adpater:
import android.app.Fragment;
import android.app.FragmentManager;
import android.os.Bundle;
import android.support.v13.app.FragmentPagerAdapter;
public class ScheduleFragment_Pager_adapter extends FragmentPagerAdapter {

        private String CurrentSelectedYearID="",CurrentSelectedTermID="";

        public ScheduleFragment_Pager_adapter(FragmentManager fm , String SelectedYearID , String SelectedTermID) {
            super(fm);
            CurrentSelectedYearID = SelectedYearID;
            CurrentSelectedTermID = SelectedTermID;
        }

        @Override
        public Fragment getItem(int position) {

            Bundle bundle = new Bundle();
            bundle.putString("CurrentSelectedYearID", CurrentSelectedYearID);
            bundle.putString("CurrentSelectedTermID",CurrentSelectedTermID);

            if(position==0)
            {
                ClassesFragment classesFragment = new ClassesFragment();
                classesFragment.setArguments(bundle);
                return classesFragment;
            }
            else if(position==1)
            {
                ExamsFragment examsFragment = new ExamsFragment();
                examsFragment.setArguments(bundle);
                return examsFragment;
            }

            return null;
        }

        public int getItemPosition(Object object) {
            return POSITION_NONE;
        }

        @Override
        public int getCount() {
            return 2;
        }

        @Override
        public CharSequence getPageTitle(int position) {
            switch (position) {
                case 0:
                    return "Classes";
                case 1:
                    return "Exams";
            }
            return null;
        }
    }

I have tried to use this answer, but It did not work , or I couldn't understand it !
and here how I use the adapter and how I try to update it.
at onCreateView of a Main Fragment [I am working with nested Fragment]
  mViewPager.setAdapter(new ScheduleFragment_Pager_adapter(getChildFragmentManager(), mSelectedYearID, mSelectedTermID));

and I update the adapter like this
@Override    
public void onActivityResult(int requestCode, int resultCode, Intent data) {
        if(requestCode == 0){
            if(resultCode == Activity.RESULT_OK){
                mSelectedTermID = data.getStringExtra("mSelectedTermID");
                mSelectedYearID = data.getStringExtra("mSelectedYearID");
                mViewPager.getAdapter().notifyDataSetChanged();
            }
        }
    }

Where, the onActivityResult is where mSelectedTermID and mSelectedYearID are being updated.
any Help?

A:

make adapter class variable in fragment
private ScheduleFragment_Pager_adapter adapter;

onCreateView of a Main Fragment 
adapter = new ScheduleFragment_Pager_adapter(getChildFragmentManager(), mSelectedYearID, mSelectedTermID)
 mViewPager.setAdapter(adapter);

in your adapter
public void setValues( String SelectedYearID , String SelectedTermID) {
        CurrentSelectedYearID = SelectedYearID;
        CurrentSelectedTermID = SelectedTermID;
    }

onActivityResult
  adapter.setValues(mSelectedTermID, mSelectedYearID);
  adapter.notifyDataSetChanged();

