title: Android PagerAdapter :: Get Current Item into bitmap
body: <p>I am using UniversalImageLoader for my application. My <code>ImageAdapte</code>r extends <code>PagerAdapter</code>. I need currentImage as Bitmap. By callback methood <code>public void onLoadingComplete(Bitmap loadedImage)</code> i am getting bitmap. But that is not that bitmap image currently showing. Either it is the next image or previous image (depending upon swaping). Here is the full code:</p>
  
  <pre><code>    private class ImagePagerAdapter extends PagerAdapter {
      private String[] images;
      private LayoutInflater inflater;
  
      ImagePagerAdapter(String[] images) {
          this.images = images;
          inflater = getLayoutInflater();
      }
  
      @Override
      public void destroyItem(View container, int position, Object object) {
          ((ViewPager) container).removeView((View) object);
      }
  
      @Override
      public void finishUpdate(View container) {
      }
  
      @Override
      public int getCount() {
          return images.length;
      }
  
      @Override
      public Object instantiateItem(View view, int position) {
          if (view != null) {
              final View imageLayout = inflater.inflate(
                      R.layout.item_pager_image, null);
              final ImageView imageView = (ImageView) imageLayout
                      .findViewById(R.id.image_item_pager);
  
              imageLoader.displayImage(images[position], imageView, options,
                      new ImageLoadingListener() {
  
                          @Override
                          public void onLoadingStarted() {
                          }
  
                          @Override
                          public void onLoadingFailed(FailReason failReason) {
                              //On Loading Failed Logic                               
                          }
  
                          @Override
                          public void onLoadingComplete(Bitmap loadedImage) {
                                                          bitmap = loadedImage;  
                              imgViewSetAsWp.setImageBitmap(bitmap);
                          }
  
                          @Override
                          public void onLoadingCancelled() {
                              // Do nothing
                          }
                      });
  
  
              ((ViewPager) view).addView(imageLayout, 0);
  
              return imageLayout;
          } else
              return view;
      }
  
      @Override
      //Other override methood of ImagePager
  
  }
  </code></pre>
  
  <p>Is there any way to get the proper bitmap. </p>