ViewPager is trying to recreate a Fragment from bad data
<p>The main problem I am running into is that when I try to update my PagerAdapter with a brand new set of data, I get a FC. More specifically, I get the FC only if I remove something from the PagerAdapter's dataset.</p>

<p>In my Main activity I have this loader callback: </p>

<pre><code>@Override
public void onLoadFinished(Loader&lt;Cursor&gt; loader, Cursor newCursor) {
    List&lt;CycleItem&gt; cycleItems = CursorInflator.inflateList(newCursor, CycleItem.class);
    mCycleAdapter.setCycleList(cycleItems);
    mIndicator.notifyDataSetChanged();
}
</code></pre>

<p>Here is my CycleViewPagerAdapter (mCycleAdapter is a reference to this):</p>

<pre><code>public class CycleViewPagerAdapter extends FragmentPagerAdapter implements TitleProvider {

    private ArrayList&lt;CycleItem&gt; mCycleItems;
    private CyclePagerCallbacks mParent;

    public CycleViewPagerAdapter(CyclePagerCallbacks parent, FragmentManager fm) {
        super(fm);
        mParent = parent;
        mCycleItems = new ArrayList&lt;CycleItem&gt;();
    }

    public CycleViewPagerAdapter(FragmentManager fm, List&lt;CycleItem&gt; cycleItems) {
        super(fm);
        mCycleItems = (ArrayList&lt;CycleItem&gt;) cycleItems;
    }

    public void setCycleList(List&lt;CycleItem&gt; cycleItems) {
        mCycleItems = (ArrayList&lt;CycleItem&gt;) cycleItems;
        notifyDataSetChanged();
    }

    @Override
    public Fragment getItem(int position) {
        return CycleDetailFragment.newInstance(mParent, mCycleItems.get(position % mCycleItems.size()).getId());
    }

    public String getTitle(int position) {
        return mCycleItems.get(position % mCycleItems.size()).getName();
    }

    @Override
    public int getCount() {
        if (mCycleItems != null) {
            return mCycleItems.size();
        } else {
            return 0;
        }
    }

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

}
</code></pre>

<p>This CycleViewPagerAdapter creates and returns CycleDetailFragments when the getItem method is called. Here is that class: </p>

<pre><code>public class CycleDetailFragment extends Fragment implements PaginatedFragmentProtocol {

    public interface CyclePagerCallbacks {
        public void removeCycle(Uri cycleUri);
    }

    private static final String TAG = "CycleDetailFragment";

    private CyclePagerCallbacks mParent;
    private long mCycleId;
    private Cycle cycle;
    private static final String CYCLE_ID_KEY = "cycle_id";

    private TextView mCycleName;
    private TextView mNumItem;
    private Button mDeleteCycle;

    public static CycleDetailFragment newInstance(CyclePagerCallbacks parent, long cycleId) {
        CycleDetailFragment cycleDetailFragment = new CycleDetailFragment(parent);

        Bundle bundle = new Bundle();
        bundle.putLong(CYCLE_ID_KEY, cycleId);
        cycleDetailFragment.setArguments(bundle);

        return cycleDetailFragment;
    }

    public CycleDetailFragment(CyclePagerCallbacks parent) {
        mParent = parent;
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Bundle arguments = getArguments();
        if (arguments != null) {
            mCycleId = arguments.getLong(CYCLE_ID_KEY);
        } else {
            mCycleId = 0;
        }

        Log.i(TAG, Long.toString(mCycleId));

        final Uri cycleUri = ContentUris.withAppendedId(CycleContentProvider.CONTENT_URI, mCycleId);
        Cursor cursor = getActivity().getContentResolver().query(cycleUri, null, null, null, null);

        final Cycle cycle = CursorInflator.inflateOne(cursor, Cycle.class);

        Uri cycleItemsUri = ContentUris.withAppendedId(CycleItemContentProvider.CYCLE_ID_FIELD_CONTENT_URI, mCycleId);
        Cursor cycleItemsCursor = getActivity().getContentResolver().query(cycleItemsUri, null, null, null, null);


        mCycleName.setText(cycle.getName() + " " + cycle.getId());
        mNumItem.setText(Integer.toString(cycleItemsCursor.getCount()));

        mDeleteCycle.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                getActivity().getContentResolver().delete(cycleUri, null, null);
                mParent.refresh();
            }
        });

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

        Log.i("Creating View", "Cycle ID: " + mCycleId);
        View view = inflater.inflate(R.layout.cycle_detail, container, false);

        mCycleName = (TextView) view.findViewById(R.id.cycle_name);
        mNumItem = (TextView) view.findViewById(R.id.num_items);
        mDeleteCycle = (Button) view.findViewById(R.id.delete_cycle);

        return view;
    }

    @Override
    public String getFragmentTitle() {
        return cycle.getName();
    }

}
</code></pre>

<p>So you see that the CycleDetailFragment looks in the database for information to populate the view. </p>

<p>Here is the problem I am having. After I DELETE a Cycle from the database,  the onLoadFinished method is called and the cycleItems is populated with the correct items, but once mCycleAdapter.setCycleList(cycleItems) is called after this deletion I get my error. The onAcitivityCreated method in the CycleDetailFragment is called (not by me or my PagerAdapter - something else internal), but it is fed data that should no longer exist! The bundle that it is passed contains the cycleId of the item that I just deleted and that does not exist in the freshly pulled cycleItems list that I just created. So, it tries to pull something from the database that no longer exists and null pointer exceptions are thrown. </p>

<p>How can I refresh the dataset of my PagerAdapter without the ViewPager trying to use old data first? </p>
