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

  • SEARCH
  • Home
  • 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 8379389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:10:22+00:00 2026-06-09T16:10:22+00:00

I know this is asked before and I have already searched a lot about

  • 0

I know this is asked before and I have already searched a lot about this but could not get any proper answer on my issue.

I have created a list, the list gets filled with data that is coming from JSON. Now inside getView() method, I am inflating my custom row with data. Each row contains a Thumbnail, and I am creating each thumbnail from a different thread.

Now the problem is, everything is going well until I don’t scroll my list. When I scroll my list, my getView() method is called continuously , and all thumbnail images are getting recreated and its position is getting shuffled. Once thumbnails are created I don’t want to recreate them and also I want to maintain the order of my thumbnails.

Can you please guys help me on this?

Any help will greatly be appreciated.

My getView() method is:

@Override
public View getView(final int position, View convertView,
                ViewGroup parent) {

            ViewHolder viewHolder = new ViewHolder();
            if (convertView == null) {
                inflater = getLayoutInflater();
                convertView = inflater.inflate(R.layout.list_item_row, parent,
                        false);
                viewHolder.titleText = (TextView) convertView
                        .findViewById(R.id.titleText);
                viewHolder.thumbImage = (ImageView) convertView
                        .findViewById(R.id.thumbnail);
                convertView.setTag(viewHolder);
            } else {
                viewHolder = (ViewHolder) convertView.getTag();
            }

            final String thumbnailURLString = mPostsList.get(position).get(
                    "thumb");
            createBitmapThread = (Thread) getLastNonConfigurationInstance();
            createBitmapThread = new MyThread(thumbnailURLString,
                    viewHolder.thumbImage);
            createBitmapThread.start();
            viewHolder.titleText.setText(title);

            return convertView;
        }

And the Thread class:

public class MyThread extends Thread {

        String mThumbURLString = null;
        ImageView mImageView = null;

        public MyThread(String thumbnailURLString, ImageView imageView) {
            mThumbURLString = thumbnailURLString;
            mImageView = imageView;
        }

        @Override
        public void run() {

                try {
                    URL newurl = null;
                    try {
                        newurl = new URL(mThumbURLString);
                    } catch (MalformedURLException e) {
                        e.printStackTrace();
                    }
                    try {
                        // Options opts = new Options();
                        /*
                         * opts.inDither = true; opts.inInputShareable = true;
                         * opts.inJustDecodeBounds = true; opts.inPurgeable =
                         * true;
                         */
                        Log.e("", "INSIDE IMAGE DOINBG");
                        mBitmap = BitmapFactory
                                .decodeStream((InputStream) newurl.getContent());
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                    mHandler.post(new MyRunnable(mImageView));
                } finally {

                }


    }

    public class MyRunnable implements Runnable {

        ImageView mImageView = null;

        public MyRunnable(ImageView imageView) {
            mImageView = imageView;
        }

        public void run() {
            mImageView.setImageBitmap(mBitmap);
        }
    }
  • 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-06-09T16:10:24+00:00Added an answer on June 9, 2026 at 4:10 pm

    ok , here how i did a similar thing:

    for each getView , create a new Fetching class and put it into a concurrent/synchronized stack . in the meanwhile , set the bitmap of the view to be empty (or anything else you wish) . you can also use caching instead.

    the class will contain info of how to load the data (for example , the url of the bitmap) , the view to update , and the result of the fetching (for example , the bitmap itself) .

    now , back to the getView, create&execute an asyncTask that will use a loop on the stack , each time it gets a Fetching class instance from the stack (once it’s empty,the asyncTask will break the loop and finish) , check that the view that needs to be updated still needs the data (using its viewHolder) load the bitmap , set the result into the Fetching class , and pass it through the publishProgress() function.

    in the onProgressUpdate method , do the same check as before using the Fetching class instance and the viewHolder . if all went well , update the view to have the bitmap that was fetched .

    a nice yet complicated example of how to handle the same problem can be found here .

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this topic is asked before but they were not about jqueryui. Therefore
I know this kind of questions have been asked already many times before. The
I know variants of this question have been asked before (even by me), but
i know this question was asked before but i have this very weird beginner
I know this has been asked before, but nothing is working. I have signed
I know questions like this have been asked before, and I've viewed a lot
I know this has been asked before, but I just can't seem to get
I know this question was asked before but I have the following simple code
I know this specific question has been asked before , but I am not
I know this has been asked before but I have looked at every answer

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.