title: How do I put the adapter into the viewpager?
body: <p>This is the code of MyPageAdapter</p>
  <pre><code>public class MyPageAdapter extends PagerAdapter {
      int[] images = {R.drawable.img1, R.drawable.img2, R.drawable.img3, R.drawable.img4, R.drawable.img5, R.drawable.img6, R.drawable.img7, R.drawable.img8, R.drawable.img9, R.drawable.img10, R.drawable.img11, R.drawable.img12, R.drawable.img13
              , R.drawable.img14, R.drawable.img15, R.drawable.img16, R.drawable.img17, R.drawable.img18, R.drawable.img19, R.drawable.img20, R.drawable.img21, R.drawable.img22, R.drawable.img23, R.drawable.img24
              , R.drawable.img25, R.drawable.img26, R.drawable.img27, R.drawable.img28, R.drawable.img29, R.drawable.img30};
  
      private  LayoutInflater inflater;
      private Context context;
  
      public MyPageAdapter(Context context){
          this.context = context;
      }
  
      @Override
      public int getCount() {
          return images.length;
      }
  
      @Override
      public boolean isViewFromObject(@NonNull View view, @NonNull Object object) {
          return view == ((LinearLayout)object);
      }
  
      @Override
      public Object instantiateItem(ViewGroup container, int position) {
          inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
          View v = inflater.inflate(R.layout.fragment_slideshow, container, false);
          EditText editText = v.findViewById(R.id.editTextNumberDecimal);
          ImageView imageView = (ImageView)v.findViewById(R.id.imageView2);
          imageView.setImageResource(images[position]);
          int text = position+1;
          editText.setText(text);
          container.addView(v);
          return v;
      }
  
      @Override
      public void destroyItem(ViewGroup container, int position, Object object) {
          container.invalidate();
      }
  }
  </code></pre>
  <p>AND this is the code of SlideshowFragment.</p>
  <pre><code>public class SlideshowFragment extends Fragment {
  
  
      public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
         View root = inflater.inflate(R.layout.fragment_slideshow, container, false);
  
         ViewPager2 viewPager2 = (ViewPager2) root.findViewById(R.id.pager);
         MyPageAdapter adapter = new MyPageAdapter(this);
         viewPager2.setAdapter(adapter);
  
          return root;
      }
  }
  </code></pre>
  <p>I would like to add a view pager to the slide fragment so that 30 photos can be viewed as a slide show.
  But I can't do setAdapter in viewpager.
  Really, is there anything other than a way to make and put each fragment for each of the 30 pictures?
  Please let me know how to modify my code.</p>