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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:07:19+00:00 2026-06-16T03:07:19+00:00

I am loading about 200 images from a MySQL database into my android application.

  • 0

I am loading about 200 images from a MySQL database into my android application.
When I try to store them all in Bitmaps and ArrayLists of Bitmaps, I soon get an out of memory exception.

I would like to know what the best way of storing these images is. I could save them all on the sd-card and only save the path to them in my app.

But I also need to always show these images in the pages of a ViewPager (about 8 images are displayed per page). If I fill the ViewPager with images from the ressources, Android and the ViewPager manages the memory-issues itself (it removes non-displayed images from the RAM when it runs out of memory and loads them back, when you scroll back to them)

How can I manage storing so many images without running out of memory?

  • 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-16T03:07:20+00:00Added an answer on June 16, 2026 at 3:07 am

    With the limited memory available you will not be able to have a direct reference to each of the images, otherwise like you say you will run out of memory. These images will take up space in memory as long as there is a reference to your BitMap objects. To free up this memory you need to dereference these BitMaps and or clear the ArrayList, this will allow the Garbage Collector to free up the unused memory. Ideally you only want a reference only to the images you can see, or the ones you will see next.

    You could just look up the 8 images for every page view, or perhaps the the images in the surrounding page views. If the images you are display are much larger than the size they take up then you may want to resize these images on the fly and only store them as the size they appear, this should also help reduce the memory footprint of your images.

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

Sidebar

Related Questions

we're loading about 30 full 320 x 480 images into an animations array. These
How should I go about loading (or updating) a database for my RoR application?
Loading images into Flex (size < 100kb) causes IE7 memory increase by a megabyte
I have a question about loading JSONP into HTML. This is my JSONP file:
I have seen lot of threads about loading a PDF in Android Webview. But
I have this strange problem about loading images using AsyncTask in ListView.In my ListView,
I read a few tutorials about loading shared libraries and call functions in them.
I know questions about loading XML into a JS variable have been posted here
I got this jQuery pre-loading script running on a index.html page loading about 10Mb
I have a bizarre problem, IE 7 and 8 are not loading about 80%

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.