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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T02:40:25+00:00 2026-06-06T02:40:25+00:00

OK this is a very common problem but mine is a bit different and

  • 0

OK this is a very common problem but mine is a bit different and I can’t find solution on other topics, so I post new one here. I have an application which show a ListView. Each row of ListView, I have an ImageView to load a small bitmap icon from SD card using ListAdapter (it’s small so the problem is not about the size). Now if I scroll the list slowly, it works fine. But if I scroll really fast, when the ListView is long enough, it’s not showing the icon anymore and messages in logcat is something like this:

126 600-byte external allocation too large for this process.

VM will not let us allocate 126,600 bytes

Then the app crash and logcat showed:

java.lang.OutOfMemoryError: bitmap size exceeds VM budget

I tested on 2 different devices and only 1 of them get this error, the other works normally.
Please notice that this error only occurred when the ListView is scrolled very fast. Is that because new threads created is not matched with the pace of garbage collection or something?
Can anybody give me some suggestion in this situation?

  • 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-06T02:40:27+00:00Added an answer on June 6, 2026 at 2:40 am

    While working with bitmap you will mostly get OutOfMemory when used with ListView.

    So you should go for LasyList as show here.

    Will will take care of your image loading.

    To work with SDCard you need to replace a method in ImageLoader Class as shown below

    private Bitmap getBitmap(String url) 
        {
            // If is from SD Card
            try {
                File file = new File(url);
                if(file.exists())
                {
                    return BitmapFactory.decodeFile(url);
                }
            } catch (Exception e) {
    
            }
    
            File f=fileCache.getFile(url);
    
            //from SD cache
            Bitmap b = decodeFile(f);
            if(b!=null)
                return b;
    
            //from web
            try {
                Bitmap bitmap=null;
                URL imageUrl = new URL(url);
                HttpURLConnection conn = (HttpURLConnection)imageUrl.openConnection();
                conn.setConnectTimeout(30000);
                conn.setReadTimeout(30000);
                conn.setInstanceFollowRedirects(true);
                InputStream is=conn.getInputStream();
                OutputStream os = new FileOutputStream(f);
                Utils.CopyStream(is, os);
                os.close();
                bitmap = decodeFile(f);
                return bitmap;
            } catch (Exception ex){
               ex.printStackTrace();
               return null;
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I think this is a very common situation, but I can't find how everybody
It seems a very common problem. But I couldn't find any working solution. We
This seems to be a very common problem of mine: data = [1 2
I am sure this problem is very common but a quick googling didn't get
This might be a very common and old problem, but still I've struggled with
this question is about style, because i think this is a very common problem
This is a very common but rarely solved topic. I seriously need some help
I know that this is very common problem and I have gone through almost
I know this is very common question but I am really stuck in this
I know this is the most common problem in the history of programming but

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.