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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T10:22:17+00:00 2026-06-08T10:22:17+00:00

I am having an activity with a listview in it. The listview is populated

  • 0

I am having an activity with a listview in it. The listview is populated from a large XML pulled from a server.
My scenario usually is to have a SAX parser, parse the XML and return a Vector(or similar structure) with the parsed data.
The problem is that the xml is too big and the Vector has too many elements which causes out of memory errors.
Also the xml has links to images which are being downloaded and this makes the situation even worse.

How should I manage the memory in such cases? I was thinking if I could make the images load only when the user scrolls to a given row in the list view.

  • 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-08T10:22:20+00:00Added an answer on June 8, 2026 at 10:22 am

    The problem of out of memory exceptions is the loading of the images. The Adapter shouldn’t have a problem in populating itself in a ListView.

    In a business application I am loading a ListView with 9000 records with 2 TextViews in each row. So I guess the size of the data should not be a problem.

    Use an AsyncTask to fetch the data from the server. Parse and populate the adapter in the doInBackground() method and then in onPostExecute() set the Adapter in the ListView. At first try not to include any of the images so as to make sure that data size is not a problem.

    If the ListView loads correctly then try and find a way to populate the images. There are multiple ways in doing this operation. If the images are the same over and over again you should try to “cache in memory” implementation, otherwise perhaps “lazyloading” from a background thread should do the job just fine.

    EDIT:

    this is a very good post/tutorial on how to lazyload images from a background thread. It is “almost” the same technique like the android market uses when you are viewing all the applications in a GridView, when at first there are some grey icons and then suddenly the image of the application appear. This is done from a background thread, when the exact row is visible to the user then the background thread fetches it from the internet, populates the list and it caches it in memory so as to be available again in no time. Lazy load of images in ListView

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

Sidebar

Related Questions

I am having a problem in searching a ListView. In my activity I have
I am working on Activity having ListView & i request an php file from
I have a listview that is being populated by information from a database using
I have a ListView activity that start a new intent. When Back pressed from
I'm having some trouble with the positioning in an android listview, the next activity
im having trouble getting a string (containing a URL) from one activity to another.
I am having trouble with my activity management. So I have activity A which
I have an activity with three listviews, each having three different cursors, but all
I'm having trouble trying to use a list in my activity. My XML for
I have a a listview with each row having a text field and edittext

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.