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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:27:36+00:00 2026-06-15T09:27:36+00:00

Possible Duplicate: bitmap size exceeds Vm budget error android I have developed one android

  • 0

Possible Duplicate:
bitmap size exceeds Vm budget error android

I have developed one android example.here i got the below error:

java.lang.OutOfMemoryError: bitmap size exceeds VM budget

here my console window shows following error:

11-23 22:15:55.933: E/dalvikvm-heap(2522): 22458-byte external allocation too large for this process.
11-23 22:15:55.933: E/GraphicsJNI(2522): VM won't let us allocate 22458 bytes
11-23 22:15:55.993: D/AndroidRuntime(2522): Shutting down VM
11-23 22:15:55.993: W/dalvikvm(2522): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
11-23 22:15:56.054: E/AndroidRuntime(2522): FATAL EXCEPTION: main
11-23 22:15:56.054: E/AndroidRuntime(2522): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ssmobileproductions.catalogue/com.ssmobileproductions.catalogue.SingleMenuItem}: android.view.InflateException: Binary XML file line #93: Error inflating class android.widget.ImageButton
11-23 22:15:56.054: E/AndroidRuntime(2522):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
 11-23 22:15:56.054: E/AndroidRuntime(2522):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
 11-23 22:15:56.054: E/AndroidRuntime(2522):    at android.app.ActivityThread.access$2300(ActivityThread.java:125)
11-23 22:15:56.054: E/AndroidRuntime(2522):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
11-23 22:15:56.054: E/AndroidRuntime(2522):     at android.os.Handler.dispatchMessage(Handler.java:99)
11-23 22:15:56.054: E/AndroidRuntime(2522):     at android.os.Looper.loop(Looper.java:123)
 11-23 22:15:56.054: E/AndroidRuntime(2522):    at android.app.ActivityThread.main(ActivityThread.java:4627)
 11-23 22:15:56.054: E/AndroidRuntime(2522):    at java.lang.reflect.Method.invokeNative(Native Method)
 11-23 22:15:56.054: E/AndroidRuntime(2522):    at java.lang.reflect.Method.invoke(Method.java:521)
 11-23 22:15:56.054: E/AndroidRuntime(2522):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
 11-23 22:15:56.054: E/AndroidRuntime(2522):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
 11-23 22:15:56.054: E/AndroidRuntime(2522):    at dalvik.system.NativeStart.main(Native Method)
 11-23 22:15:56.054: E/AndroidRuntime(2522): Caused by: android.view.InflateException: Binary XML file line #93: Error inflating class android.widget.ImageButton
 11-23 22:15:56.054: E/AndroidRuntime(2522):    at android.view.LayoutInflater.createView(LayoutInflater.java:513)
 11-23 22:15:56.054: E/AndroidRuntime(2522):    at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
 11-23 22:15:56.054: E/AndroidRuntime(2522):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
 11-23 22:15:56.054: E/AndroidRuntime(2522):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
 11-23 22:15:56.054: E/AndroidRuntime(2522):    at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
 11-23 22:15:56.054: E/AndroidRuntime(2522):    at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
 11-23 22:15:56.054: E/AndroidRuntime(2522):    at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
 11-23 22:15:56.054: E/AndroidRuntime(2522):    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
 11-23 22:15:56.054: E/AndroidRuntime(2522):    at android.app.Activity.setContentView(Activity.java:1647)
 11-23 22:15:56.054: E/AndroidRuntime(2522):    at com.ssmobileproductions.catalogue.SingleMenuItem.onCreate(SingleMenuItem.java:35)
 11-23 22:15:56.054: E/AndroidRuntime(2522):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
 11-23 22:15:56.054: E/AndroidRuntime(2522):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
 11-23 22:15:56.054: E/AndroidRuntime(2522):    ... 11 more
 11-23 22:15:56.054: E/AndroidRuntime(2522): Caused by: java.lang.reflect.InvocationTargetException
 11-23 22:15:56.054: E/AndroidRuntime(2522):    at android.widget.ImageButton.<init>(ImageButton.java:78)
 11-23 22:15:56.054: E/AndroidRuntime(2522):    at java.lang.reflect.Constructor.constructNative(Native Method)
 11-23 22:15:56.054: E/AndroidRuntime(2522):    at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
 11-23 22:15:56.054: E/AndroidRuntime(2522):    at android.view.LayoutInflater.createView(LayoutInflater.java:500)
 11-23 22:15:56.054: E/AndroidRuntime(2522):    ... 22 more
 11-23 22:15:56.054: E/AndroidRuntime(2522): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
 11-23 22:15:56.054: E/AndroidRuntime(2522):    at android.graphics.Bitmap.nativeCreate(Native Method)
 11-23 22:15:56.054: E/AndroidRuntime(2522):    at android.graphics.Bitmap.createBitmap(Bitmap.java:468)
  11-23 22:15:56.054: E/AndroidRuntime(2522):   at android.graphics.Bitmap.createBitmap(Bitmap.java:435)
 11-23 22:15:56.054: E/AndroidRuntime(2522):    at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:340)
 11-23 22:15:56.054: E/AndroidRuntime(2522):    at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:488)
 11-23 22:15:56.054: E/AndroidRuntime(2522):    at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:462)
 11-23 22:15:56.054: E/AndroidRuntime(2522):    at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:323)
  11-23 22:15:56.054: E/AndroidRuntime(2522):   at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697)
  11-23 22:15:56.054: E/AndroidRuntime(2522):   at android.content.res.Resources.loadDrawable(Resources.java:1709)
   11-23 22:15:56.054: E/AndroidRuntime(2522):  at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
  11-23 22:15:56.054: E/AndroidRuntime(2522):   at android.widget.ImageView.<init>(ImageView.java:118)
  11-23 22:15:56.054: E/AndroidRuntime(2522):   at android.widget.ImageButton.<init>(ImageButton.java:82)
  11-23 22:15:56.054: E/AndroidRuntime(2522):   ... 26 more

This is my bitmap code:

 private Bitmap getBitmap(String url) 
{
    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;
    }
}

//decodes image and scales it to reduce memory consumption
private Bitmap decodeFile(File f){
    try {
        //decode image size
        BitmapFactory.Options o = new BitmapFactory.Options();
        o.inJustDecodeBounds = true;
        BitmapFactory.decodeStream(new FileInputStream(f),null,o);

        //Find the correct scale value. It should be the power of 2.
        final int REQUIRED_SIZE=70;
        int width_tmp=o.outWidth, height_tmp=o.outHeight;
        int scale=1;
        while(true){
            if(width_tmp/2<REQUIRED_SIZE || height_tmp/2<REQUIRED_SIZE)
                break;
            width_tmp/=2;
            height_tmp/=2;
            scale*=2;
        }

        //decode with inSampleSize
        BitmapFactory.Options o2 = new BitmapFactory.Options();
        o2.inSampleSize=scale;
        return BitmapFactory.decodeStream(new FileInputStream(f), null, o2);
    } catch (FileNotFoundException e) {}
    return null;
    }

please help me how can i resolve this error.

  • 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-15T09:27:38+00:00Added an answer on June 15, 2026 at 9:27 am

    You just need to make your search more scrupulously.

    Here is the best, IMO, link which may helps to answer your question.

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

Sidebar

Related Questions

Possible Duplicate: OutOfMemoryError: bitmap size exceeds VM budget :- Android I have code like
Possible Duplicate: java.lang.OutOfMemoryError: bitmap size exceeds VM budget - Android the following error occur
Possible Duplicate: OutOfMemoryError: bitmap size exceeds VM budget :- Android Im in the process
Possible Duplicate: OutOfMemoryError: bitmap size exceeds VM budget :- Android In my application I
Possible Duplicate: Bitmap recycle with largeHeap enabled hi am doing one app here i
Possible Duplicate: Android: How to overlay-a-bitmap/draw-over a bitmap? I have implement the android Camera
Possible Duplicate: Android : Bitmap save to location I have successfully created a QR
Possible Duplicate: Can i save lots of bitmaps to one bitmap? (2d) I wonder
Possible Duplicate: Android, move bitmap along a path? I want to move an image
Possible Duplicate: Combine two Images into one new Image I have a c# code

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.