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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T03:30:44+00:00 2026-06-17T03:30:44+00:00

I am working on an android application. I have an activity that contains a

  • 0

I am working on an android application. I have an activity that contains a list view.

The list view has lots of items and each contains a bitmap image.

Because the list is very big and contains a lot of images it is giving and out of memory error on some old devices when loading the bitmaps.

So I am looking for a way to do the following for old devices:

  • Load the bitmaps for the items that are in the view (or near it)
  • When the user scrolls down I load the bitmaps that should appear to him and remove the bitmaps that are now hidden.
  • So at anytime only the images that are in the view (or near it) are loaded in the Heap while the others are removed when they are no longer in the view.

Is there a way to do it?

Additional information:

I have followed every instructions and code on how to load Bitmap images efficiently (on the android documentation and on any site that I could find), I also made sure there is no memory leaks, I recycle every bitmap and make sure the GC works correctly and finally, on old devices I made the resolution of the images the smallest possible. But the size of the list is causing the out of memory to still appear on some devices.

So I am looking to know if I can do the above proposed solution.

Thanks a lot for any help

  • 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-17T03:30:45+00:00Added an answer on June 17, 2026 at 3:30 am

    You should consider looking at Sample Gallery App from Google I/O 2012. Everything you need is implemented there.

    Video from Google I/O about gallery app

    Source code is available on Google Code and it’s an exclellent example of building a Gallery. You should also consider looking at Romain Guy’s presentation (beginning) where he explains performance issues with ListView and teaches to use adapters efficiently. (ViewHolder pattern and reusing views).

    Here’s a RecycleListener for GridView (Available from API level 1). A RecyclerListener is used to receive a notification whenever a View is placed inside the RecycleBin’s scrap heap. This listener is used to free resources associated to Views placed in the RecycleBin.

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.album);
    
        mAdapter = new PhotoAdapter(this);
    
        mGridView = (GridView) findViewById(android.R.id.list);
        mGridView.setAdapter(mAdapter);
    
        mGridView.setRecyclerListener(new RecyclerListener() {
            @Override
            public void onMovedToScrapHeap(View view) {
                // Release strong reference when a view is recycled
                final ImageView imageView = (ImageView) view.findViewById(android.R.id.icon);
                imageView.setImageBitmap(null);
            }
        });
    
        // Kick off loader for Cursor with list of photos
        getLoaderManager().initLoader(LOADER_CURSOR, null, mCursorCallbacks);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on an Android application. I have an activity that has this method:
I'm working on an Android application that has several Activities. In it I have
I am working on an application for android and we since we have lots
I have a simple (?) Android application that begins with an Activity (First Activity)
I'm working on an application that got an activity that is set to have
i have an android application which has a listview for listing 14 items inside
I am developing an Android Application and I have an Activity that looks like
I’m working on an android application that currently has two Activities, A and B,
I'm working on an application that currently has two activites, a log in activity
I am working on Android Application. Now I have requirement of search the entered

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.