Q:

FragmentStatePagerAdapter resets content of first fragment

When App starts it's showing first fragment and preparing second one, when I slide to second it's preparing third... When I slide back from second to third everythink is fine but when slide 1 -> 2 -> 3 -> 2 -> 1 the first one content has been reseted... What could be a problem here? 
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v7.app.AppCompatActivity;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.view.ViewPager;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

public class MainActivity extends AppCompatActivity{

    private SectionsPagerAdapter mSectionsPagerAdapter;
    private ViewPager mViewPager;

    FoldersFragment foldersFragment = new FoldersFragment();
    NowPlayingFragment nowPlayingFragment = new NowPlayingFragment();
    EqFragment eqFragment = new EqFragment();

    public ViewPager getMViewPager() {
        return mViewPager;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());

        mViewPager = (ViewPager) findViewById(R.id.container);
        mViewPager.setAdapter(mSectionsPagerAdapter);

        foldersFragment.setNowPlayingFragment(nowPlayingFragment);
        nowPlayingFragment.setFoldersFragment(foldersFragment);
        eqFragment.setMediaPlayer(nowPlayingFragment.mp);
    }

    public static class PlaceholderFragment extends Fragment {

        public PlaceholderFragment() {
        }

        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
            View rootView = inflater.inflate(R.layout.fragment_main, container, false);
            return rootView;
        }
    }

    public class SectionsPagerAdapter extends FragmentStatePagerAdapter {

        public SectionsPagerAdapter(FragmentManager fm) {
            super(fm);
        }

        @Override
        public Fragment getItem(int position) {

            switch (position) {
                case 0:
                    System.out.println("0");
                    return foldersFragment;
                case 1:
                    System.out.println("1");
                    return nowPlayingFragment;
                case 2:
                    System.out.println("2");
                    return eqFragment;
            }

            return null;
        }

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

A:

The default offscreen limit is 1 so each time you go to the next fragment it will check if there is fragment that is already been offscreen and will be restarted when you go back to it:
if you are currently at page 3
1 -> |offset| 2 -> (3) -> 4 -> |offset| 5
so page 1 and page 5 will be restarted if it is before or after the current page + the offset.
To increase the offset you can call:
mViewPager.setOffscreenPageLimit(4)

