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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:31:36+00:00 2026-05-13T10:31:36+00:00

I had a question related to whether or not (and how) I should store

  • 0

I had a question related to whether or not (and how) I should store images loaded from the web. Let’s say I am calling a web service from my Android app. In this web service I get a URL for an image on the web. I download and show this image on the left side of a list item in a ListView. My question is, what method should I use for possibly storing the image? Should I:

  1. Save it to the SDCard, checking if it exists when the ListView is created (on subsequent requests) and re-downloading as necessary (while updating the image occasionally, in case it changes).
  2. Store it in the cache using Context.getCacheDir(), but possibly being forced to re-download it more often since I cannot rely on the image staying in the cache.
  3. Always download it and never store the image.

The image files themselves are fairly small, but I expect some users could have dozens of these small images downloaded/stored. Which would work best, and/or what is the preferred method?

As a side question, should I load all of the images in my ListView first (and possibly lock the UI for some time) or load them asynchronously but show a placeholder graphic in the meantime (which might be a bit more “ugly”)? What’s the standard here?

  • 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-13T10:31:36+00:00Added an answer on May 13, 2026 at 10:31 am

    About where to store:
    The answer depends on what is being downloaded and how much. Then you make a choice.

    For instance: If you are downloading something that is temporary, less in number(less remote fetches) and size(less memory) and is local to an Activity then you should consider holding the images in memory using SoftReferences. SoftReferences can lead to refetches but since the number of items is small it should be affordable.

    However, if the number of items to be downloaded exceeds a certain threshold(meaning more fetches and memory) you should consider reducing the fetches and also the Runtime memory consumption by caching them. Here you can either choose to save them on Sdcard or on temporary storage(cache directories local to app). For items that are small and hold meaning only in the context of Application(e.g thumbnails), the user will mostly not use it outside of your application. So, you can store such things in the cache directory. The best part of using them is that you don’t have to clean the mess. It is handled automatically. It might lead to re-fetches though.

    However, if the downloaded items are large in size and can stand alone outside the context of the application such as pictures, video, audio clips then SDcard should be your option.
    You should also read: Handling large Bitmaps to avoid OOM error during BitmapFactory.decodeStream(..)

    Note that you can also check to see if using a database can help here.See this

    Some considerations while lazy loading items in a ListView:
    You should do the loading in the background and not block the UI thread.You should consider showing a temporary image while the item is being downloaded. This is apparent in many native applications. For an example implementation of lazy loading see this.
    Additionally, for large lists, you can implement the SlowAdapter pattern(check API demos).
    It basically stalls download while the list is scrolling.

    Example Projects that can help you here:

    Romain Guy’s Shelves project uses two level of caching wherein he employs an in-memory cache(HashMap containing SoftReferences) and storage on Sdcard.Browse Source code here

    There are also some open source libraries that Mark Murphy wrote(CWAC) and DroidFu that can help here.

    Good Luck!

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

Sidebar

Related Questions

This is actually related to another question I had that was already answered. That
I had a question answered which raised another one, why following does not work?
I know I asked a related question earlier. I just had another thought. using
I had a question related to phpmyadmin. I have a table with the following
One year ago Mitchel Sellers had a related question... I would like to access
I had recently asked a related question In C# how do I have a
I asked a related question about findbugs, but let's ask a more general question.
The following question is related to a question that I had asked earlier: Help
I am working on this problem and had previously asked related question. Implementation of
I had this question earlier and it was concluded it was a bug in

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.