0

I have an application with a fragments. In one activity there is 3 fragment which is frag1,frag2 and frag3 . It is possible that The OncreateView will trigger is just for frag1 only . In my case frag1 and frag2 are the first to read the onCreateView Event. I just want the frag1 only and when you swipe the frag2 will read and so on.

1 Answers1

0

With the viewPager you are able to set the number of fragment created with the method setOffScreenPageLimit but unfortunatly I think you will not be able to create only one fragment (the one visible). What will happen when you will slide? As the second fragment is not created, a blank screen... To be smoothy when scrolling, the second fragment view has to be already created.

Check this response: ViewPager.setOffscreenPageLimit(0) doesn't work as expected

Community
  • 1
  • 1
Chol
  • 2,097
  • 2
  • 16
  • 26