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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:17:13+00:00 2026-06-04T16:17:13+00:00

When I change to landscape mode, few objects are created with bitmap of full

  • 0

When I change to landscape mode, few objects are created with bitmap of full screen.

When I scroll the other object is called and its bitmap is displayed, when I doing this repeatedly , bitmap size exceeds vm budget error, I have done all the things like recycle(), set null and then called GC(), still I have same error. creating bitmap….

    bitmap = Bitmap.createBitmap(ChartProperties.getChartWidth(), 
                    ChartProperties.getChartHeight(),
    Bitmap.Config.RGB_565);

    imageCache.put(String.valueOf(LandscapeChartActivity.getActiveFeature()),
                    new SoftReference(bitmap));

    if(imageCache != null){

        for (int i = 0; i < imageCache.size(); i++) {

            if (imageCache.get(String.valueOf(i)) != null) {
                imageCache.get(String.valueOf(i)).get().recycle();
                imageCache.put(String.valueOf(i), null);                    
            }

        }
        Runtime.getRuntime().gc();
        imageCache.clear();
        imageCache = null;
  • 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-04T16:17:14+00:00Added an answer on June 4, 2026 at 4:17 pm

    I also had the same problem OOME because of bitmaps.

    When orientation changes from PORTRAIT to LANDSCAPE and vice-versa, the previous UI is completely discarded, and a new UI is loaded and displayed, In this case if you are using many bitmaps in your app, you need to release them at proper places.

    To check the orientation of your device, please see this: Check orientation on Android phone

    In your case, you need to clear bitmaps during orientation change.

    On above link you can found, how to get the current orientation. So on each orientation change, call your above code that cleans up the bitmaps.

    Now, when we check the logcat, there is always a log comes up saying GC_, but I could not understand that, so
    I found an amazing doc on memory leak issue: http://codelog.dexetra.com/getting-around-android-memory-blues

    The above link is very useful for your problem.

    Now, the OOME occurs when there is memory leak in your app., so to check that, please install the MAT for eclipse. You can find it at: http://www.eclipse.org/mat/downloads.php

    Its a bit complicated software but as you go through it, you will understand, its pretty useful software.

    Even if this doesn’t solves your problem, use the WeakReference for bitmaps.

    Please refer this link: How to use WeakReference in Java and Android development?

    If I get know some more info, I will update this post.

    Please update your post, if you get solution to your problem.

    Thank you 🙂

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

Sidebar

Related Questions

Is there a way to change ImageView drawable with its corresponding drawable for landscape
Trying to change fragment width when user rotate device to landscape mode That is
As my application working fine in Portrait mode but if i change it to
In landscape mode the ApplicationBar is placed on the side and it has a
I have a problem with showing keyboard in landscape mode. My activity contains an
hello all i have my splash screen which i want to show in landscape
I am doing a project which supports both landscape mode and portrait mode,but now
I have weird situation with EditText. Situation: set device to landscape mode enter text
I want to change first view in portrait mode and the second view comes
I have an app which displays in landscape mode and I've overwritten the height

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.