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 9047305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T11:52:47+00:00 2026-06-16T11:52:47+00:00

I am making an android application where there are news articles with a thumbnail.

  • 0

I am making an android application where there are news articles with a thumbnail. Those thumbnails are loaded from network and stored in a LruCache with the URL as the key, and the bitmap as the value.

private LruCache<String, Bitmap> tCache;

in the getView() method of the adapter, I call getThumbnail() which checks the cache (load from network when necessary) then show the thumbnail.

public void populateList(){
    ...
    new Thread(new Runnable() {
        @Override
        public void run() {
            getThumbnail(story, thumbnail);
        }
    }).start();
}

and

private Bitmap getThumbnail(Story story, ImageView imageView) {
    String url = story.getThumbnail();

    Bitmap bitmap;
    synchronized (tCache) {
        bitmap = tCache.get(url);

        if (bitmap == null) {

            bitmap = new ImageLoadingUtils(this, imageView).execute(url,
                    Boolean.TRUE).get();
            tCache.put(url, bitmap);

        }
    }
    return bitmap;

}

The ImageLoadingUtils loads from network and puts the resulting bitmap in the ImageView when done.

@Override
protected void onPostExecute(Bitmap result) {
    if (imageView != null) {
        imageView.setImageBitmap(result);
        adapter.notifyDataSetChanged();
    }
}

The problem is the thumbnails get repeated in the same ListView when I scroll down.

________
|IMAGE1|
|IMAGE2|
|IMAGE3|  SCREEN
|IMAGE4|
--------
|IMAGE1|
|IMAGE2|  OFFSCREEN
________

And the articles don’t have the correct thumbnails anymore when I scroll down then back up. It’s very messed up.

Anyone can spot the issue? Thank you a lot.

  • 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-16T11:52:48+00:00Added an answer on June 16, 2026 at 11:52 am

    The problem is because the Views are reused in a listview. Here is a good example on how to cache and load thumbnails asynchronously in listview.

    Lazy Load ListView Android

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

Sidebar

Related Questions

I am making an android application that loads files from a directory on the
I am making an android application, which takes an image from camera and then
I'm making an android application, where there is a view composed of hundreds of
So I'm making this android application, that needs to read data from user-provided CSV
I'm going to be making HTTP requests in an android application. There is some
I am making an android application. There i want a common navigation menu on
I am making an android application to show the position of a user on
I am making an android application which has a main activity and several other
I am making an Android application. In my application, I have to find the
I'm making an android application using phonegap. I'm using phonegap's Storage api for querying

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.