Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6336535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:04:35+00:00 2026-05-24T19:04:35+00:00

I have am using a This LoaderImageView in a gallery. 1st I show a

  • 0

I have am using a This LoaderImageView in a gallery. 1st I show a grid for thumbnail image. When user click on a thumbnail image I get that position and pass to a new activity that show gallery of “LoaderImageView” that get the large image from internet and meanwhile show ProgressBar.

What I want to do is when user select a image then there should be also b automatic call for next , previous view. Actually View load the image.

I am trying to do this using OnItemSelectedListener();

There is the code. But this is not working fine.It go to 1st image when I just scroll for previous. and also not working as per my logic.

class BigImageAdapter extends BaseAdapter {

    DisplayMetrics displayMatrics;
    HashMap<String, Bitmap> hasLargeBitmap;
    SharedPhotosData sharedPhotosData;
    Context mContext;

    public BigImageAdapter(Context contex, SharedPhotosData photoData) {

        mContext = contex;
        displayMatrics = new DisplayMetrics();
        hasLargeBitmap = new HashMap<String, Bitmap>();
        getWindowManager().getDefaultDisplay().getMetrics(displayMatrics);
        sharedPhotosData = photoData;
    }

    public void recycleAllBitmap() {
        try {
            int i = 0;
            Collection<Bitmap> temp = hasLargeBitmap.values();
            for (Bitmap bitmap : temp) {
                if (bitmap != null) {
                    if (bitmap.isRecycled() == false) {
                        bitmap.recycle();
                        i++;
                    }
                }
            }
            Log.e("Recycled", "No of images recycled"+i);

        } catch (Exception e) {
            e.printStackTrace();
        }

    }

    public int getCount() {

        if (sharedPhotosData != null) {
            if (sharedPhotosData.photoData != null) {
                return sharedPhotosData.photoData.size();
            } else {
                Log.e(TAG, "sharedData.photoData is null");
            }
        } else {
            Log.e(TAG, "sharedData is null");
        }

        return 0;
    }

    public Object getItem(int position) {
        return position;
    }

    public long getItemId(int position) {

        return position;
    }

    public View getView(int position, View convertView, ViewGroup parent) {
        View rowView = null;
        try {
            MyData curData = null;
            curData = sharedPhotosData.photoData.get(position);
            if (convertView == null) {
                String imagePath = Environment.getExternalStorageDirectory().toString() + SMConstants.FILE_PATH_BASE
                        + SMConstants.S3Folders.PHOTO + curData.getLargeURLLocalPath() + "/" + SMConstants.FILE_NAME_PREFIX
                        + curData.getFileName();
                if (hasLargeBitmap.containsKey(imagePath) == false) {
                    rowView = new AsynImageView(hasLargeBitmap, PhotoGalleryActivity.this, curData);
                } else {
                    Bitmap image = hasLargeBitmap.get(imagePath);

                    ImageView mImageView = new ImageView(mContext);
                    mImageView.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT,
                            Gravity.CENTER));
                    mImageView.setImageBitmap(image);
                    mImageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
                    mImageView.setAdjustViewBounds(true);
                    rowView = mImageView;
                }
                rowView.setLayoutParams(new Gallery.LayoutParams(android.view.ViewGroup.LayoutParams.FILL_PARENT,
                        android.view.ViewGroup.LayoutParams.FILL_PARENT));
            } else {
                rowView = convertView;
            }

        } catch (Exception e) {
            Log.e("Exception", "LargeSlideShow.GetView  Message = " + e);
            e.printStackTrace();
        } catch (Error e) {
            Log.e("Error", "LargeSlideShow.GetView Message = " + e);
            e.printStackTrace();
        }
        return rowView;
    }
}

@Override
public void onItemSelected(AdapterView<?> parent, View v, int position, long id) {
    try {

        if (position - 1 >= 0) {
            myGalleryForLargeImage.setSelection((position - 1));
        }
        if (position + 1 < size) {
            myGalleryForLargeImage.setSelection((position + 1));
        }
    } catch (Exception e) {
        Log.e(TAG, "Exception = " + e.toString());
        e.printStackTrace();
    }
}

@Override
public void onNothingSelected(AdapterView<?> arg0) {

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T19:04:36+00:00Added an answer on May 24, 2026 at 7:04 pm

    Ok. I found that instead of doing “myGalleryForLargeImage.setSelection((position – 1));” It must done. As now it try to get View and when getView() method called It initiate that image request.

    @Override
    public void onItemSelected(AdapterView<?> parent, View v, int position, long id) {
        try {
    
            if (position - 1 >= 0) {
                bigImageAdapter.getView(position-1, null, myGalleryForLargeImage);
            }
            if (position + 1 < size) {
                bigImageAdapter.getView(position+1, null, myGalleryForLargeImage);
            }
        } catch (Exception e) {
            Log.e(TAG, "Exception = " + e.toString());
            e.printStackTrace();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been using this approach to get the facebook big profile image http://graph.facebook.com/<FBUID>/picture?type=large
I have a file hosting site that's using this script MFHS . I want
I have been using this code with great success to pull out the first
I have been using this copy method for quite a while, in lots of
I have been using this as a reference, but not able to accomplish exactly
Since I have started using this site, I keep hearing about the Boost library.
anyone have any experience using this? if so, is it worth while?
Using this file as source, I have a situation where I need to retrieve
I have installed Qt for windows CE using this link http://qt.nokia.com/products/platform/qt-for-windows-ce for visual studio8,
I have turned computer monitor off using this command SendMessage(f.Handle, WM_SYSCOMMAND, (IntPtr)SC_MONITORPOWER, (IntPtr)(turnOff ?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.