title: FragmentPagerAdapter class is deprecated. How to solve FragmentPagerAdapter issue
body: <p><strong>FragmentPagerAdapter class is deprecated</strong></p>
  <p><em>Since API 27 FragmentPagerAdapter is deprecated. What's the best alternative to use for this?</em></p>
  <blockquote>
  <p><a href="https://stackoverflow.com/questions/71185247/fragmentpageradapter-class-is-deprecated-how-to-solve-fragmentpageradapter-issu">How to solve FragmentPagerAdapter issue.</a></p>
  </blockquote>
  <ul>
  <li>Follow my code you easily solve this problem.</li>
  </ul>
  <p><strong>imports :</strong></p>
  <pre><code>import androidx.fragment.app.FragmentManager
  import androidx.fragment.app.FragmentPagerAdapter
  </code></pre>
  <p><strong>My Old Code :</strong></p>
  <pre><code>public class PagerAdapter extends FragmentPagerAdapter {
      
    public PagerAdapter(@NonNull FragmentActivity fragmentActivity) {
          super(fragmentActivity);
  
      }
  int tab_count;
  public PagerAdapter(@NonNull FragmentManager fm, int behavior) {
      super(fm, behavior);
      tab_count=behavior;
  }
  
  @NonNull
  @Override
  public Fragment getItem(int position) {
      switch (position)
      {
          case 0 : return new Ftab1();
          case 1 : return new ftab2();
          case 2 : return new Ftab3();
          default: return null;
      }
  }
  
  @Override
  public int getCount() {
      return tab_count;
  }
  </code></pre>
  <p><strong>My New Code :</strong></p>
  <ul>
  <li><p>Follow my code you easily solve this problem.
  Note:</p>
  </li>
  <li><p>Replace FragmentPagerAdapter with FragmentStateAdapter</p>
  </li>
  <li><p>Create string of your fragment name</p>
  </li>
  <li><p>In XML &amp; JAVA File,Replace ViewPager with <a href="https://developer.android.com/training/animation/vp2-migration" rel="nofollow noreferrer"><strong>ViewPager2</strong></a>.</p>
  </li>
  <li><p>Done</p>
  <pre><code> public class PagerAdapter extends FragmentStateAdapter {
  
   String[] fragment_names = new String[]{&quot;chat&quot;,&quot;status&quot;,&quot;call&quot;};
   public PagerAdapter(@NonNull FragmentActivity fragmentActivity) {
       super(fragmentActivity);
  
   }
  
   @NonNull
   @Override
   public Fragment createFragment(int position) {
       switch (position)
       {
           case 0 : return new Ftab1();
           case 1 : return new ftab2();
           case 2 : return new Ftab3();
           default: return null;
       }
  
   }
  
   @Override
   public int getItemCount() {
       return fragment_names.length;
   }
  </code></pre>
  <p>}</p>
  </li>
  </ul>