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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:08:01+00:00 2026-05-23T12:08:01+00:00

I currently have a ListView with a custom adapter that gets information describing the

  • 0

I currently have a ListView with a custom adapter that gets information describing the content of the rows asynchronously. Part of each row is an image URL, that I’m planning to download asynchronously and then display.

My current plan for a strategy to download these images is:

  • Keep a cache of soft references to downloaded Bitmap objects.
  • When a getView() is called and the bitmap is in the cache, set the bitmap for the ImageView directly.
  • If the bitmap isn’t in the cache, start loading it in a separate thread, after the download is complete add it to the cache and call notifyDataSetChanged() on the adapter.

I am also planning to kill pending downloads when the Activity object owning the ListView’s onDestroy()-method (Or possibly even in the onPause()-method) is called, but most importantly I want to kill the download of pending images when the row goes off screen. I might only actually cancel the download after a short delay, so it can be resumed without wasting bandwidth if the row comes on-screen quickly again.

I, however, am unsure about a few things:

  • What is the best way to detect when a row goes off-screen so I can cancel the download?
  • Is calling notifyDataSetChanged() the best thing to do after the download has completed or is there a better way?

Also any comments on the whole strategy would be appreciated.

  • 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-23T12:08:02+00:00Added an answer on May 23, 2026 at 12:08 pm

    I don’t think calling notifyDataSetChanged() is really needed… I would do it like that:

    • store URL as Tag in the view when created/updated
    • register a listener in downloader thread (async task???) for download keeping reference to the view and the URL
    • whenever image is downloaded asynchronously, I check TAG in the view and if it matches – i would update the ImageView (important to do it in UI thread, but when using async task, it is given). The image should also be stored on SD card (and every time you request URL you should check if it is not already downloaded).
    • every time when getView() reuses the view (passed view is not empty) I would check the Tag (old URL), replace it with the new URL and cancel the download of the oldURL.

    I think it would be pretty much it (some corner cases might happen)…

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

Sidebar

Related Questions

I have a ListView that is fed by an SQLiteDB. On each row returned,
I have a listview with a custom arrayadapter that handles about 15 strings. The
Summary: Trying to dynamically add heading rows to a ListView via a custom adapter
What I have: A custom listview with a custom adapter, with a custom ListViewItem
I have a listview which loads its data from sqlite database. Each row in
i got the following problem. i have a ListView with custom rows consisting of
I have a custom ListView adapter which implements an ImageThreadLoader class. Unfortunately, the class
I have a custom ListView adapter which implements an ImageThreadLoader class. Unfortunately the class
I have a custom listview which changes size when one of the rows is
I currently have a listview and I want to add an appropriate icon to

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.