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

  • Home
  • SEARCH
  • 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 7519213
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:51:54+00:00 2026-05-30T01:51:54+00:00

in my program i am trying to select image from image gallary. The problem

  • 0

in my program i am trying to select image from image gallary. The problem is while trying to select new imgaes continiously for two to three times i am getting “bitmap size exceeds VM budget” exception

this is my code onActivity result

    public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode == RESULT_OK) {
        switch (requestCode) {
        case SELECT_IMAGE:
            String imagePath = getPath(data.getData());
            Savingimagepath(imagePath);
            img.setImageDrawable(Drawable.createFromPath(imagePath));
            break;
        }
    }
}

Any one pls help to over come this problem…

This is my log cat…

02-16 12:16:57.870: W/dalvikvm(2198): threadid=1: thread exiting with uncaught exception (group=0x40015560)
02-16 12:16:57.870: E/AndroidRuntime(2198): FATAL EXCEPTION: main
02-16 12:16:57.870: E/AndroidRuntime(2198): java.lang.OutOfMemoryError: bitmap size exceeds VM budget
02-16 12:16:57.870: E/AndroidRuntime(2198):     at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
02-16 12:16:57.870: E/AndroidRuntime(2198):     at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:470)
02-16 12:16:57.870: E/AndroidRuntime(2198):     at android.graphics.BitmapFactory.decodeFile(BitmapFactory.java:284)
02-16 12:16:57.870: E/AndroidRuntime(2198):     at android.graphics.BitmapFactory.decodeFile(BitmapFactory.java:309)
02-16 12:16:57.870: E/AndroidRuntime(2198):     at android.graphics.drawable.Drawable.createFromPath(Drawable.java:800)
02-16 12:16:57.870: E/AndroidRuntime(2198):     at palmagent.FidelityAgent.CA.contact.onActivityResult(contact.java:249)
02-16 12:16:57.870: E/AndroidRuntime(2198):     at android.app.Activity.dispatchActivityResult(Activity.java:3908)
02-16 12:16:57.870: E/AndroidRuntime(2198):     at android.app.ActivityThread.deliverResults(ActivityThread.java:2528)
02-16 12:16:57.870: E/AndroidRuntime(2198):     at android.app.ActivityThread.handleSendResult(ActivityThread.java:2574)
02-16 12:16:57.870: E/AndroidRuntime(2198):     at android.app.ActivityThread.access$2000(ActivityThread.java:117)
02-16 12:16:57.870: E/AndroidRuntime(2198):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:961)
02-16 12:16:57.870: E/AndroidRuntime(2198):     at android.os.Handler.dispatchMessage(Handler.java:99)
02-16 12:16:57.870: E/AndroidRuntime(2198):     at android.os.Looper.loop(Looper.java:130)
02-16 12:16:57.870: E/AndroidRuntime(2198):     at android.app.ActivityThread.main(ActivityThread.java:3683)
02-16 12:16:57.870: E/AndroidRuntime(2198):     at java.lang.reflect.Method.invokeNative(Native Method)
02-16 12:16:57.870: E/AndroidRuntime(2198):     at java.lang.reflect.Method.invoke(Method.java:507)
02-16 12:16:57.870: E/AndroidRuntime(2198):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
02-16 12:16:57.870: E/AndroidRuntime(2198):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
02-16 12:16:57.870: E/AndroidRuntime(2198):     at dalvik.system.NativeStart.main(Native Method)
  • 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-05-30T01:51:55+00:00Added an answer on May 30, 2026 at 1:51 am

    You should create a drawable to fit exactly a ImageView (img) sizes. If you open a large image (like photo) and set it as a drawable to ImageView it’s required a lot of memory.

    Just create a bitmap with really target sizes like this

    BitmapFactory.Options opts = new BitmapFactory.Options();
    //The max size of any dimension (height or width) is 400 px
    opts.inSampleSize = originalSize / 400;
    Bitmap bmp = BitmapFactory.decodeFile(imagePath, opts);
    img.setImageBitmap(bmp);
    img.recycle();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to select current program (which is happening now) from this table.
I am trying to write a program to select a random name from the
I am trying to select all the files from a folder in my website
I'm trying to use a list_box to select from different types of conversions. When
I am trying to select data from a DB2 database managed by another person
I am trying to program (while learning JQuery) the following: I have a form
I'm trying to get my current program to take information from a dynamically created
When I am trying to execute the program I am getting an error like
i have two tables, program and event. what i am trying to do is
I'm trying to select a column from a single table (no joins) and I

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.