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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:29:48+00:00 2026-06-11T05:29:48+00:00

I had freed every object, recycle all the bitmaps in onDestroy() method: private void

  • 0

I had freed every object, recycle all the bitmaps in onDestroy() method:

     private void unbindDrawables(View view) {
    if (view.getBackground() != null) {
    view.getBackground().setCallback(null);
    }
    if (view instanceof ViewGroup) {
        for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) {
        unbindDrawables(((ViewGroup) view).getChildAt(i));
        }
    ((ViewGroup) view).removeAllViews();
    }
}
@Override
protected void onDestroy()
{
    super.onDestroy();
    unbindDrawables(findViewById(R.id.RootView));
            bitmap.recycle();
            bitmap=null;
    System.gc();

}

I have done this coding in every class onDestroy() method. But still my logcat shows me the error like:

            FATAL EXCEPTION: main
            java.lang.RuntimeException: Unable to start activity ComponentInfo{}: android.view.InflateException: Binary XML file line #2: Error inflating class android.widget.RelativeLayout
             android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
             android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
             android.app.ActivityThread.access$600(ActivityThread.java:123)
             android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
             android.os.Handler.dispatchMessage(Handler.java:99)
             android.os.Looper.loop(Looper.java:137)
             android.app.ActivityThread.main(ActivityThread.java:4424)
             java.lang.reflect.Method.invokeNative(Native Method)
             java.lang.reflect.Method.invoke(Method.java:511)
        com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
        com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
             dalvik.system.NativeStart.main(Native Method)
           Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class android.widget.RelativeLayout
           android.view.LayoutInflater.createView(LayoutInflater.java:606)
                com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
            android.view.LayoutInflater.onCreateView(LayoutInflater.java:653)
            android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:678)
            android.view.LayoutInflater.inflate(LayoutInflater.java:466)
            android.view.LayoutInflater.inflate(LayoutInflater.java:396)
             android.view.LayoutInflater.inflate(LayoutInflater.java:352)
           com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:251)
           android.app.Activity.setContentView(Activity.java:1835)
           android.app.Activity.performCreate(Activity.java:4465)
          android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
          android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
          ... 11 more
          Caused by: java.lang.reflect.InvocationTargetException
          java.lang.reflect.Constructor.constructNative(Native Method)
          java.lang.reflect.Constructor.newInstance(Constructor.java:417)
          android.view.LayoutInflater.createView(LayoutInflater.java:586)
        ... 23 more
              Caused by: java.lang.OutOfMemoryError
              android.graphics.Bitmap.nativeCreate(Native Method)
              android.graphics.Bitmap.createBitmap(Bitmap.java:605)
              android.graphics.Bitmap.createBitmap(Bitmap.java:551)
              android.graphics.Bitmap.createScaledBitmap(Bitmap.java:437)
              android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:524)
              android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:499)
              android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:351)
          android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:773)
           android.content.res.Resources.loadDrawable(Resources.java:1935)
           android.content.res.TypedArray.getDrawable(TypedArray.java:601)
           android.view.View.<init>(View.java:2785)
            android.view.View.<init>(View.java:2722)
            android.view.ViewGroup.<init>(ViewGroup.java:379)
           android.widget.RelativeLayout.<init>(RelativeLayout.java:174)
          ... 26 more
  • 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-11T05:29:49+00:00Added an answer on June 11, 2026 at 5:29 am

    The title says it all — you are trying to allocate 73 megabytes of heap at once, for one image. This alone exceeds the heap size available on even most modern devices — 64 megabytes. You need to find a way to use a significant smaller image.

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

Sidebar

Related Questions

Had a problem with the recursive conflictCheck() method. That seems fine now. I have
I had some memory problems due to Xcode's template for a UIPageViewController caching all
I recently had my free application published in Mac Appstore. I'm trying to find
My company purchased Visual Studio Pro 2008 last year, which had a 'free' copy
ACL seems to be very confusing and never problem-free. Although, I've had no major
Had to download Command Line Tools from Apple to get make to work, but
Had a good read through similar topics but I can't quite a) find one
Had received a module from CCAVENUE and it was working fine with Magento 1.6.2...
Had a page that was working fine. Only change I made was to add
Had a good search here but can't see anything that gets my mind in

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.