Q:

Nested ViewPager returns null after rotation

I need a reference to VerticalViewPager in PageFragSanningellerKonsekvens. 
I got two ViewPagers: one for horizontal swiping that goes on for ever, and one for vertical swiping that loads three fragments (mid, swipe up, swipe down) that loads content. The horizontal ViewPager loads a new instance of VerticalViewPager on every swipe. I need a reference in the actual fragment that is loaded by the VerticalViewPager, so that I can swipe vertically by tapping a button. I also need a reference to the horizontal ViewPager to allow the first page to have a button that triggers a horizontal swipe.
I've solved it by sending the reference as an argument like this:
FragSanningEllerKonsekvens - The class that initializes the VerticalViewPager.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    view = inflater.inflate(R.layout.fragment_sanning_eller_konsekvens, container, false);
    initComponents();
    setComponents();
    return view;
}

private void initComponents() {
    verticalViewPager = (VerticalViewPager) view.findViewById(R.id.verticalviewpager);
    mStatementPagerAdapter = new TruthDarePagerAdapter(getChildFragmentManager()).newInstance(getChildFragmentManager(),mViewPager, verticalViewPager);
}

Its transfers in TruthOrDarePagerAdapter:
private ViewPager mViewPager;
private VerticalViewPager mVerticalViewPager;
public static TruthDarePagerAdapter newInstance(FragmentManager fm, ViewPager mViewPager, VerticalViewPager mVerticalViewPager){
    TruthDarePagerAdapter horizontalPagerAdapter = new TruthDarePagerAdapter(fm);
    horizontalPagerAdapter.setViewPager(mViewPager);
    horizontalPagerAdapter.setVerticalViewPager(mVerticalViewPager);
    return horizontalPagerAdapter;
}

public VerticalViewPager getVerticalViewPager() {
    return mVerticalViewPager;
}

public void setVerticalViewPager(VerticalViewPager mVerticalViewPager) {
    this.mVerticalViewPager = mVerticalViewPager;
}

private void setViewPager(ViewPager mvViewPager){
    this.mViewPager = mvViewPager;
}

private ViewPager getViewPager(){
    return mViewPager;
}

@Override
public Fragment getItem(int position) {
    PageFragSanningellerKonsekvens frag = new PageFragSanningellerKonsekvens().newInstance(getViewPager(), getVerticalViewPager());
.
.
.
    return frag;
}

PageFragSanningellerKonsekvens - The class that needs the reference.
public static PageFragSanningellerKonsekvens newInstance(ViewPager mViewPager, VerticalViewPager mVerticalViewPager){
    PageFragSanningellerKonsekvens frag = new PageFragSanningellerKonsekvens();
    frag.setViewPager(mViewPager);
    frag.setVerticalViewPager(mVerticalViewPager);
    return frag;
}

private void setupMenu() {

    viewTop = view.findViewById(R.id.sek_top);
    viewBottom = view.findViewById(R.id.sek_bottom);

    viewTop.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            getVerticalViewPager().setCurrentItem(0, true);
        }
    });

    viewBottom.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            getVerticalViewPager().setCurrentItem(2, true);
        }
    });
}

The code above works excellent until I rotate the device. After rotation the getVerticalViewPager() returns null. In other parts of the application I've used this pattern without any problems: on rotation the ViewPager is sent as a parameter and the application reloads without dropping the reference. 
So the conclusion I've drawn is that the VerticalViewPager doesn't get reinitialized on rotation, while PageFragSanningellerKonsekvens is. 
My question is; how can I solve it? Can I force it to be reinitialized, or can I obtain a reference to it in some other way? 
EDIT 1: I'll think its related to getItem() in the FragmentStatePagerAdapter. It will be called to allocate 3 fragments at every given time. I think this might nullify the getVerticalViewPager() method.
EDIT 2: I moved some code to allow the  ViewPager and the button to be initialized in the same class, thus making it somewhat null-proof. Thanks for the help!

A:

Ok this might not be a complete answer but I think it would be too long a comment. 
I think you are right that the null pointer happens at getItem in the adapter. (a logcat report to confirm this would be nice). 
The reason for this (I think) is that the adapter tries to recreate the inner fragments before the inflation of the ViewPager is complete. Normally I create similar adapters in onCreate because it normally do not rely on anything but a fragmentmanager. 
Having this in mind, and the fact that you might have a hard time avoiding the null pointer in the current design, I propose a new design. 
Am only at my phone right now so is hard to give you the code I have in mind. For now I just sketch the idea:

Move the getter/setter of ViewPagers from the adapter to FragSanningEllerKonsekvens, leaving the creation of TruthOrDarePagerAdapter only depend on fragment manager 
Now do the same for PageFragSanningellerKonsekvens making it simply PageFragSanningellerKonsekvens.newInstance() in getItem of the adapter 
Finally, you are now missing the reference to the ViewPagers in PageFragSanningellerKonsekvens PageFragSanningellerKonsekvens,  but remember you now have the getters of both ViewPagers in the parent FragSanningEllerKonsekvens

So the buttons now become: 
((FragSanningEllerKonsekvens)getParentFragment()).getVerticalViewPager().setCurrentItem(0, true);

And
((FragSanningEllerKonsekvens)getParentFragment()).getVerticalViewPager().setCurrentItem(2, true);

