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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:50:52+00:00 2026-05-27T01:50:52+00:00

I am implementing an android application in which I am attaching images to issues.

  • 0

I am implementing an android application in which I am attaching images to issues. These attachments are of two types,

attachment by using camera
attachment of photo from gallery (already existing photo in gallery)
I am getting these Images as follows,

//Camera Request
Intent captureImage = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);

captureImage.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, imageFileUri);
startActivityForResult(captureImage, CAMERA_PIC_REQUEST);

// Gallery Pic request
Intent intent = new Intent(Intent.ACTION_PICK,
        android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
        startActivityForResult(intent, GALLERY_PIC_REQUEST);

The result of above is URI. And I am saving this uri.getPath() in my database.

Now problem is when I want to show these images I am fetching it with the help of uri I am having. But I am getting an exception after loading first image; java.lang.OutOfMemoryError: bitmap size exceeds VM budget

I read some blogs and I came to know that memory is insufficient for loading it.

Is anybody having working solution on compressing images while showing them in a list And recycle memory used after work is done??

  • 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-27T01:50:52+00:00Added an answer on May 27, 2026 at 1:50 am
                                            Display display = getWindowManager().getDefaultDisplay(); 
    
                                            int width = display.getWidth();
                                            int height = display.getHeight();
    
    
                                            int bitmap_width = photoBitmap.getWidth();
                                            int bitmap_height = photoBitmap.getHeight();
        // where photoBitmap is your Bitmap image                                   
    
                                            if(bitmap_width >width)
                                                bitmap_width = width ;
    
                                            if(bitmap_height>height)
                                             bitmap_height = height ;
    
    
    // compressing bitmap goes here
                                            photoBitmap = Bitmap.createScaledBitmap (photoBitmap, width, height, false);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Background I'm writing application for android, using Eclipse in Windows. I'm implementing C code
I am implementing android application which is on web service. I'm creating login Activity
I am implementing an application in which I play two sounds ( touchandshow followed
I'm implementing an Android activity. I am using a ListView in my application layout,
I am implementing the client side of some java application for Android devices which
I was thinking of implementing Diffie-Hellman on android mobile systems. In this application two
In android, are using static variables a recommended practice? E.g, implementing a Singleton pattern
I am implementing C2DM for push notification in an android application, it need at
I having some difficulty implementing a context menu into my android application. My first
I have an Android application that I've been working on, and it's implemented using

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.