title: Invalidation of Fragments managed by FragmentStateAdapter of ViewPager2
body: <p>My setup is as follows:</p>
  <ul>
  <li><code>ViewPager2</code> instance uses ...</li>
  <li><code>FragmentStateAdapter</code> as the adapter.</li>
  <li><code>getSupportFragmentManager</code> was passed to constructor of <code>FragmentStateAdapter</code>.</li>
  </ul>
  <p><strong>The task</strong></p>
  <p>In some situations I would like the Fragments to be recreated &quot;from scratch&quot; rather then from their <code>savedInstanceState</code>. In other words, I would like to tell the <code>ViewPager2</code>/<code>FragmentStateAdapter</code>/<code>FragmentManger</code> not to pass <code>savedInstanceState</code> bundle down to <code>Fragment.onCreate(Bundle)</code>.</p>
  <p><strong>Question</strong></p>
  <p>Is there some way to 'invalidate' cache or whatever of <code>ViewPager2</code>/<code>FragmentStateAdapter</code>/<code>FragmentManager</code> so I could control when the Fragment should be 'invalidated' (when the Fragment should be created &quot;from scratch&quot; rather then from its <code>savedInstanceState</code>)?</p>
  <p><strong>Possible solution (insufficient for my needs)</strong></p>
  <p>I know that there are <code>FragmentStateAdapter.getItemId(int)</code> and <code>FragmentStateAdapter.containsItem(long)</code> which can be used to control instantiation of Fragments. However, this solution requires a proper management of (in my case hundreds of) IDs and somehow update/modify them each time the Fragments should be recreated.</p>
  <p>Isn't there really a way to invalidate some kind of global cache?</p>