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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:48:49+00:00 2026-05-28T14:48:49+00:00

I have a ListView where each cell contains a bitmap that is downloaded from

  • 0

I have a ListView where each cell contains a bitmap that is downloaded from the internet. To avoid out of memory errors I was wondering what the best way is to deal with this.

I have looked at softreferences for the bitmaps but I was wondering what happens if I am in the current activity and the the application begins to run out of memory. How does it decide what bitmaps to recycle?

Is a better way to write the file to disk and load it into memory when I need it? Are there any examples?

Thanks

  • 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-28T14:48:51+00:00Added an answer on May 28, 2026 at 2:48 pm

    I dealt with that a while ago. Experimented with performance too. Here’s what I got.
    This answer is beyond lazy loading of images because it deals with performance.

    First of all: Forget about SoftReferences on android. Very bad for caching because of misbehavior (released to soon). I ended up using LruCache (source for API < 12) with a fixed byte size for the cache.

    When loading images through network you want to persist the loaded images (in private app data folder or SD card). Otherwise the user is forced to load (unnecessary) data on every app startup. Here’s the routine:

    1. image is requested
    2. check for image in memory cache (jump to 6. if available)
    3. is persisted locally (jump to 5. if so)
    4. load from network and persist
    5. load bitmap into cache
    6. load bitmap from cache into view

    Now some words for performance. If every list item has another image and they have a fixed size (e.g. 40 x 40 dip) you would waste cache memory when loading full images (e.g. 800 x 600 px) and your device would have to calculate a lot for scaling.

    First solution is to prescale the bitmap on step 5. before loading image into cache. You’ll get the best performance when you persist the scaled image and load it next time.

    You can find an example in my CoverCache helper (CD covers – but can be used for any kind of image data). It deals with persisting, scaling and caching images at the same time.

    • 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 binded to a ThreadSafeObservableCollection. The background of each
I have a listview with several items that are created dynamically, each has two
I have a listview with custom rows and that extends SimpleAdapter. Each row consist
I have a listview that has multiple entries and each entry has 2 subitems.
I have a ListView subclass that display rows that each contain an EditText and
I have a ListView and each row contains button. I don't want to assign
I have ListView , which displays records (movies) from the SQLite DB. Each record
I have a custom control that is derived from ListView . This list view
I have a ListView that each row has a title on the left side
I have a ListView where each row has a fixed height. Every row contains,

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.