Save state of Fragment with FragmentPagerAdapter
<p>I had create an FragmentPagerAdapter to display many question with the same Fragment.</p>

<p>This is the fragment :</p>

<p><a href="https://i.stack.imgur.com/cCnQu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cCnQu.png" alt="QuestionFragment"></a></p>

<p>When answer is give and validate, I disable button and EditText.
But when I slide of two Fragment and come back to this, EditText and Button are no longer disable and the user can change value of the edit text.</p>

<p>This is the FragmentPagerAdapter :</p>

<pre><code>    /**
     * A simple {@link Fragment} subclass.
     */
    public class PlayFragment extends FragmentPagerAdapter {

        //--Jouer un circuit
        private static Game currentGame = null; //La partie courante
        public static Circuit circ;
        private static List&lt;QuestionReponse&gt; questionsReponses = new ArrayList&lt;&gt;();

        private int PAGE_COUNT;
        private static ArrayList&lt;String&gt; listTitles = new ArrayList&lt;&gt;();

        public PlayFragment(FragmentManager fm) {
            super(fm);
            this.listTitles = new ArrayList&lt;&gt;();
            for (int i = 0; i &lt; currentGame.getDifficulties().size(); i++) {
                this.listTitles.add(currentGame.getDifficulties().get(i).getName()); //Les difficultées choisis
            }
            this.PAGE_COUNT = currentGame.getDifficulties().size();
        }


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

        @Override
        public Fragment getItem(int position) {
            return QuestionFragment.newInstance(position + 1);
        }

        @Override
        public CharSequence getPageTitle(int position) {
            // Generate title based on item position
            return listTitles.get(position);
        }

        public static Game getCurrentGame() {
            return currentGame;
        }

        public static void setCurrentGame(Game currentGame) {
            PlayFragment.currentGame = currentGame;
        }


        public static ArrayList&lt;String&gt; getListTitles() {
            return listTitles;
        }

        public static void setListTitles(ArrayList&lt;String&gt; listTitles) {
            PlayFragment.listTitles = listTitles;
        }
    }
</code></pre>

<p>This is the StartGameFragment :</p>

<pre><code>/**
 * A simple {@link Fragment} subclass.
 */
public class StartGameFragment extends Fragment implements AsyncResponse {

    PlayFragment playFragment;

    public StartGameFragment() {
        // Required empty public constructor
    }


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

        ((MainActivity) getActivity()).changeActionBarTitle(getString(R.string.nav_circuit_dl));
        MenuItem item = ((MainActivity) getActivity()).navigationView.getMenu().findItem(R.id.nav_dl_circuit);
        if (item != null) item.setChecked(true);

        //Allow to modify ActionBar menu in this fragment
        setHasOptionsMenu(true);
        //new JSONGetter().execute("");
        // Inflate the layout for this fragment
        View v = inflater.inflate(R.layout.fragment_start_game, container, false);

        ViewPager viewPager = (ViewPager) v.findViewById(R.id.viewpager);
        this.playFragment = new PlayFragment(getActivity().getSupportFragmentManager());
        viewPager.setAdapter(playFragment);

        // Give the TabLayout the ViewPager
        TabLayout tabLayout = (TabLayout) v.findViewById(R.id.sliding_tabs);
        tabLayout.setupWithViewPager(viewPager);
        return v;
    }

    @Override
    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
        super.onCreateOptionsMenu(menu, inflater);
        menu.clear();
    }


    @Override
    public void onDestroyView() {
        MenuItem item = ((MainActivity) getActivity()).navigationView.getMenu().findItem(R.id.nav_dl_circuit);
        if (item != null) item.setChecked(false);
        super.onDestroyView();
    }

    @Override
    public void onTaskDBCompleted(String result, Object entity, String method) {

    }

    @Override
    public void onTaskCompleted(String result, String method) {

    }
}
</code></pre>

<p>And finally QuestionFragment (I don't show all because too much code in this Fragment) :</p>

<pre><code>/**
 * A simple {@link Fragment} subclass.
 */
public class QuestionFragment extends Fragment implements AsyncResponse {

    public QuestionFragment() {
        // Required empty public constructor
    }


    public static QuestionFragment newInstance(int page) {
        Bundle args = new Bundle();
        args.putInt(ARG_PAGE, page);
        QuestionFragment fragment = new QuestionFragment();
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mPage = getArguments().getInt(ARG_PAGE);
    }
}
</code></pre>

<p>I tried with <a href="https://stackoverflow.com/questions/15313598/once-for-all-how-to-correctly-save-instance-state-of-fragments-in-back-stack">this solution</a> but that doesn't work for me !</p>