title: Adding and removing fragments dynamically in ViewPager
body: <p>I am using a <code>ViewPager</code> with a custom <code>PagerFragmentAdapter</code> that uses an internal list to provide fragments. I would like to add and remove fragments dynamically on settings changes. </p>
  
  <pre><code>protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.fragment_pager);
      mAdapter = new ServicePagerAdapter(getSupportFragmentManager());
      mPager = (ViewPager) findViewById(R.id.pager);
      mPager.setAdapter(mAdapter);
  }
  </code></pre>
  
  <p>I have tried to call again the <code>setAdapter</code> but I obtain an <code>IllegalStateException (Can not perform this action after onSaveInstanceState)</code>. </p>
  
  <p>How can achieve my purpose?</p>