title: Refreshing fragment which is not in focus in viewpager
body: <p>I have a dynamic viewpager which has a play button on every fragment which changes into pause button on click. </p>
  
  <p>Now what i am trying to do is that when user clicks on play button in any other fragment the play button in last playing fragment should refresh from pause to play i.e i want that play button active only in one fragment at a time rest should be in their default state.</p>
  
  <p>I tried doing this with following code</p>
  
  <pre><code>      pager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
          @Override
          public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
  
              previous =  current;
              current = position;
  
  
  
              try{
                  if(position!=0)
                  {
                      SwipeFragItem yourFragment =      (SwipeFragItem)mPageAdapter.getItem(previous);
                      yourFragment.refresh();
  
                  }
  
              }
              catch (Exception e){
                  Crashlytics.logException(e);
              }
  
  
          }
  
          @Override
          public void onPageSelected(int position) {
  
          }
  
          @Override
          public void onPageScrollStateChanged(int state) {
  
          }
      });
  </code></pre>
  
  <p>which do my task in 70% of the times but it does not refresh in 30% of the cases. I have ensured that it gets executed in these 30% of the cases and it does not throw any exception.</p>
  
  <p>If you find my approach not appropriate please suggest any other way.</p>
  
  <p>Any help will be appreciated.Thanks in advance.</p>