title: Viewpager: getting current item position
body: <p>I'm getting position  passing it from pageradapter ( to asyctask)</p>
  
  <p><em>instantiateItem(View collection, int pos) { .execute(pos);}</em></p>
  
  <p>But <strong>when I swipe to previous page it holds wrong position</strong>, How can I get the correct previous position ?</p>
  
  <p>Maybe Ican use ViewPager getCurrentItem() to retrieve the index of the current page but how can I use it with my codes ?</p>
  
  <pre><code>public class QuestionPagerAdapter extends PagerAdapter{
  
      public QuestionPagerAdapter(){
          super();
  
      }
      @Override
      public int getCount() {
          int qcount = QuestionPagerAdapter.q.getQuestionCount();
          return qcount;
      }
  
      @Override
      public boolean isViewFromObject(View view, Object object) {
          return view == ((View) object);
      }
  
      @Override
      public Object instantiateItem(View collection, int pos) {
          LayoutInflater inflater = (LayoutInflater) collection.getContext()
                  .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  
          View page = inflater.inflate(R.layout.page_quiz, null);
  
          TextView tv = (TextView)page.findViewById(R.id.questionText);
  
          QuizFetchTask fft = new QuizFetchTask(tv);
          fft.execute(pos);
  
              ((ViewPager) collection).addView(page, 0);
          return page;
      }
  
  
      @Override
      public void destroyItem(View collection, int position, Object view) {
          //Util.Log("destroying" + position);
          ((ViewPager) collection).removeView((View) view);
      }
  
  }
  </code></pre>