title: Update the current fragment in FragmentPagerAdapter
body: <p>I have a viewPager with tab indicator. The ViewPager is setAdaper with a FragmentPagerAdapter.</p>
  
  <p>I have little understanding how the internals of FragmentPagerAdapter work.
  I noticed that the neighbor fragments are resumed ( OnResume is called ) , even though the neighbor are not yet visible.</p>
  
  <p>I put the update methods in OnResume thinking that once the fragment is current, it will be updated.</p>
  
  <p><b>Ad banner refresh</b>
  <br>I want the ad banner set in the footer to update when swiping to the left once or swipping once to the right . The neighbor fragments are not recreated ( good thing ). But onResume is already called avoiding the banner refresh. The method loadBannerAd is in OnResume() method.</p>
  
  <p><br>
  <br>How can I call the method loadBannerAd() only for the current fragment <strong>by a method inside the fragment</strong> ?</p>
  
  <p>EDIT : I already know about mViewPager.setOnPageChangeListener() .</p>
  
  <pre><code>    OnPageChangeListener mOnPageChangeListener = new ViewPager.OnPageChangeListener() {
  
          @Override
          public void onPageSelected(int position) {
          // this method can be called before the fragment 's onCreateView()
          }
  
          ....
      };
  </code></pre>
  
  <p>But there is a danger when the fragment has not been created yet . Managing whether the fragment has been created or not in the Activty defeats the purepose of it.</p>
  
  <p><img src="https://i.stack.imgur.com/aiMnv.png" alt="enter image description here"></p>