title: remove fragment in viewPager2 use FragmentStateAdapter, but still display
body: <p>I have a viewPager2 and FragmentStateAdapter, and there are Fragement1, 2,3 4, I am in fragment2, and want to remove fragment3, and display fragment4 after fragment2.
  The problem is it always show me fragment3(data),  the debug shows the fragment3 has been removed, but the displayed page still has fragment3 content. </p>
  
  <p>Adpter:</p>
  
  <pre><code>class TipsAdapter(
  private val items: MutableList&lt;TripPage&gt;,
  context: FragmentActivity
  ) : FragmentStateAdapter(context) {
  
  private val fragmentFactory = context.supportFragmentManager.fragmentFactory
  private val classLoader = context.classLoader
  
  override fun getItemCount(): Int = items.size
  
  override fun createFragment(position: Int): Fragment {
      val pageInfo = items[position]
      val fragment = fragmentFactory.instantiate(classLoader, pageInfo.fragmentClass.name)
      fragment.arguments = Bundle().also { it.putParcelable(PAGE_INFO, pageInfo) }
      return fragment
  }
  
  fun getFragmentName(position: Int) = items[position].fragmentClass.simpleName
  
  fun removeFragment(position: Int) {
      items.removeAt(position)
      notifyItemRemoved(position)
      notifyItemRangeChanged(position, items.size)
      notifyDataSetChanged()
  }
  </code></pre>
  
  <p>}</p>
  
  <p>delete fragment code:</p>
  
  <pre><code>      if ((view_pager.adapter as TipsAdapter).getFragmentName(index + 1).equals(
              TripPreFragment::class.simpleName) &amp;&amp;
              viewModel.shouldRemoveBulkApply()) {
              (view_pager.adapter as TipsAdapter).removeFragment(index + 1)
              view_pager.setCurrentItem(index + 1, true)
          } else {
              view_pager.setCurrentItem(index + 1, true)
          }
  </code></pre>