Setting FragmentStatePagerAdapter count to 0 does not destroy any current visible fragments <p>I have a PagerAdapter with a dynamic number of elements. You can modify the number of tabs with a single call, which clears the list and the count to 0. Unfortunately, this does not remove the fragment that is currently showing.</p> <pre><code>public class MyPagerAdapter extends FragmentStatePagerAdapter { private List&lt;Pojo&gt; pojos = new ArrayList&lt;&gt;; @Override public int getCount() { return pojos.size(); } public void removeAll() { this.pojos.clear(); notifyDataSetChanged(); } } </code></pre> <p>Does anyone know how to force the ViewPager to clear himself?</p> <p><strong>UPDATE 1:</strong></p> <p>If you use <code>viewPager.removeAllViews()</code> then the viewPager is unusable afterwards even after adapter notifies new data changes.</p>