0

I have Created a Fragment for my bottom Tab bar, The tab bar has four fragments, In one of my fragments, I am in need of Slider to view testimonials of people one by one. In this case, I have used the ViewPager2 functionality to work on the slider, I have all the steps to create Viewpager2 from this video

https://youtu.be/KwihiADN-0k

After following all the steps I have getting an error stating

java.lang.IllegalStateException: viewpager1 must not be null (viewpager1 is my id of Viewpager2 function)

1 Answers1

0

You should define your viewpager1.adapter = viewpager1Adapter not in onCreateView(), but in onViewCreated() and your issue will be solved.