title: PagerAdapter.notifyDataSetChanged does not refresh fragments
body: <p>My <code>Activity</code> contains a <code>ViewPager</code> and it's custom <code>Adapter</code> which extends <code>FragmentStatePagerAdapter</code>. <code>ViewPager</code> contains 3 fragments</p>
  
  <p>Code to remove Fragments from the ViewPager</p>
  
  <p><code>MainActivity</code></p>
  
  <pre><code>public void deleteElement(){
      final int currentItem = mViewPager.getCurrentItem();
      mPagerAdapter.removeItem(currentItem);
      mPagerAdapter.notifyDataSetChanged();
  }
  </code></pre>
  
  <p><code>CustomPagerAdapter</code></p>
  
  <pre><code>private ArrayList&lt;Item&gt; data;
  public void removeItem(int index){
          data.remove(index);
  }
  </code></pre>
  
  <p>when removing the middle <code>Fragment</code> (index 1):</p>
  
  <ul>
  <li>from <code>data</code> i'm removing the correct <code>item</code>. </li>
  <li>Problem is that i (i guess) <code>Fragment</code> 3 is removed after <code>notifyDataSetChanged</code> and the current <code>Fragment</code> is still the fragment that the user saw and the data that is being loaded is from the <code>SavedInstance</code> bundle</li>
  </ul>
  
  <p>So the end result that the user still see the same <code>Fragment</code> that he tried to remove which is kinda suck for him.</p>
  
  <p>Ideas? </p>
  
  <p>***** <strong>EDIT</strong>   ****** </p>
  
  <p>seems like <a href="https://developer.android.com/reference/androidx/viewpager2/widget/ViewPager2" rel="nofollow noreferrer">ViewPager2</a> <a href="https://stackoverflow.com/questions/54643379/use-of-viewpager2-in-android">Features</a> might solve this issue and many other issues as well</p>