public int findImageIndex(String imgFilePath) {
   int i = 0;
   for (Image img : imageAry) {
     if (img.getimgPath().equals(imgFilePath)) return i;
     else i++;
   }
   return i;
 }
 private String getCorrectImgPath(Image image) {
   switch (image.getImgType()) {
     case ONLINE_IMG:
       return image.getLargeUrl();
     case OFFLINE_IMG:
       return image.getimgPath();
   }
   return null;
 }
  @Override
  public Object instantiateItem(View collection, int i) {

    RelativeLayout rl = new RelativeLayout(activity);
    ImageView view = new ImageView(activity);
    ProgressBar pb = new ProgressBar(activity);
    FullScreenGalleryPager fullGalleryAct = null;

    if (activity instanceof LargeGalleryMapPic) {
      galleryAct = (LargeGalleryMapPic) activity;
      dataType = galleryAct.getDataType();
      view.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    } else {
      view.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    }
    // Defining the layout parameters of the TextView
    RelativeLayout.LayoutParams lp =
        new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT);
    rl.setLayoutParams(lp);
    rl.addView(view);
    rl.addView(pb);

    Image img = imageAry.get(i);
    aRoute cRoute = new aRoute(null);
    cRoute.setX(img.getimgX());
    cRoute.setY(img.getimgY());
    cRoute.setImgUrl(img.getimgPath());
    cRoute.setCreateDate(img.getimgCreateDate());
    cRoute.setPlaceId(img.getimgPlace());

    // scrollLargeGallery(i);

    Globals.setCurrentRoute(cRoute);

    Bitmap bMap = null;

    view.setImageBitmap(bMap);
    view.setTag(img.getimgPath());
    view.setOnClickListener(imageViewOnclick);

    ((ViewPager) collection).addView(rl, 0);

    return rl;
  }
 public String getImgFilePath(int index) {
   Image img = imageAry.get(index);
   return img.getimgPath();
 }