This is a continuation from the question I 1st asked here, Creating a new ArrayPagerAdapter with variety of Fragments. You were dead on about me using the wrong ArrayAdapter I just needed to use the one that has v4 support. I have posted the code for it below. One of the next blocks i'm getting stuck on right now is creating the PageDescriptor objects in the ArrayList passed into SimplePageAdapter. I've tried copying and pasting the SimplePageDescriptor class used in the Demo into my code but I am getting an error when trying to return from the Parceable.Creator method. It says SimplePageDescriptor has private access in com.commonsware.cwac.pager.SimplePageDescriptor. I guess the main thing i'm trying to grasp is how to use the SimplePageDescriptor from the demo in my own code. Do I just use the entire pager folder? I have posted my code for the SimplePagerAdapter and the SimplePageDescriptor below.
class SimplePagerAdapter extends ArrayPagerAdapter<android.support.v4.app.Fragment> {
public SimplePagerAdapter(FragmentManager fragmentManager,
ArrayList<PageDescriptor> descriptors) {
super(fragmentManager, descriptors);
}
@Override
protected Fragment createFragment(PageDescriptor desc) {
mMainFragment = JudgeMainFragment.newInstance();
mClassifyFragment = JudgeClassifyFragment.newInstance();
mSidebarFragment = JudgeSidebarFragment.newInstance((SidebarCall) mActivity);
mVerdictFragment = JudgeVerdictFragment.newInstance();
return (mMainFragment.newInstance());
}
}
public static final Parcelable.Creator<com.commonsware.cwac.pager.SimplePageDescriptor> CREATOR=
new Parcelable.Creator<com.commonsware.cwac.pager.SimplePageDescriptor>() {
public com.commonsware.cwac.pager.SimplePageDescriptor createFromParcel(Parcel in) {
//This is the line I get the error at
return new com.commonsware.cwac.pager.SimplePageDescriptor(in);
}
public com.commonsware.cwac.pager.SimplePageDescriptor[] newArray(int size) {
return new com.commonsware.cwac.pager.SimplePageDescriptor[size];
}
};