0

i have an Activity which haves several Fragments and am using PagerAdapter for organising this Fragments , i got to know when my activity, loads all of my Fragment's codes also gets executed even when am at first Fragment at that time my whole codes of all fragment 2 or 3 also got executed which are in the onCreateView of my Fragment so can we stop this behaviour i want to execute this codes only when user selects that particular fragment

remy boys
  • 2,928
  • 5
  • 36
  • 65
  • 1
    See this thread, http://stackoverflow.com/questions/23133912/android-viewpager-update-off-screen-but-cached-fragments-in-viewpager – K Neeraj Lal May 25 '16 at 13:44

1 Answers1

0

you can limit your pager by calling this method default load number is 3

yourPager.setOffscreenPageLimit([number of pages]);

if you want just one page without preload try this link by TejjD

Community
  • 1
  • 1