title: Creating a circular View Pager but when switching from last page to first then it flickers
body: <p>Firstly this is not a duplicate question as i have checked all round but nothing found related to this.</p>
  
  <p>Now what i'm facing is : I'm trying to make a circular view pager. What i have done is :</p>
  
  <ol>
  <li>Used a <code>FragmentStatePagerAdapter</code> as I'm dealing with <code>Fragments</code> in View pager.</li>
  </ol>
  
  <p>everything is working fine but when I switch from last page to first or from first page to last on click of previous or next button in my layout then view pager flickers a bit. i.e it does not goes like normal as I'm switching between pages normally.</p>
  
  <p>I've done this  <code>viewPager.setCurrentItem(0,false);</code> when going from last to first page. And <code>viewPager.setCurrentItem(mList.size()-1,false);</code> when switching from first to last page..</p>
  
  <p>Here is my code snippet</p>
  
  <pre><code>    nextimg.setOnClickListener(new OnClickListener() {
          @Override
          public void onClick(View arg0) {
              if(viewPager.getCurrentItem()+1&gt;=mList.size()){
                  viewPager.setCurrentItem(0,false);  
              }else{
                  viewPager.setCurrentItem(getItem(+1), true);
              }
  
          }
      });
  
      previmg.setOnClickListener(new OnClickListener() {
          @Override
          public void onClick(View arg0) {
              if(viewPager.getCurrentItem()-1&lt;0){
                  viewPager.setCurrentItem(mList.size()-1,false); 
              }else{
                  viewPager.setCurrentItem(getItem(-1), true);
  
              }
          }
      });
  </code></pre>
  
  <p><strong>Adapter</strong> :</p>
  
  <pre><code>class MyPagerAdapter extends FragmentStatePagerAdapter {
  
      public MyPagerAdapter(FragmentManager fm,ArrayList&lt;Model&gt; mList) {
          super(fm);
          this.mList=mList;
  
      }
  
      @Override
      public int getCount() {
  
  
         return mList.size();
      }
  
  
      @Override
      public Fragment getItem(int position) {     
          Fragment mDetail=new DetailResultFragment(mList);
          return  mDetail; 
      }
      @Override
      public Parcelable saveState()
      {
          return null;
      }
  }
  </code></pre>
  
  <p>Any Suggestions to avoid this flickering. </p>