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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:26:44+00:00 2026-05-25T18:26:44+00:00

I have an android app that allows users to take photos. In that effort,

  • 0

I have an android app that allows users to take photos. In that effort, the image is not always correctly displayed, depending on the phone’s orientation during image capture. I have provided a rotate image feature that works on most, but not all phones. In fact, when it does not work the app crashes. The rotate feature is provided below. I appreciate any feedback that can get this to work on all phones. Also, the app just crashes and the error trap is not invoked.

private void rotateImage(float degrees){

     try{

         String imageFile = Environment.getExternalStorageDirectory()+"/"+Imagefile;
         Bitmap bitmap = BitmapFactory.decodeFile(imageFile);                       
         int width = bitmap.getWidth();
         int height = bitmap.getHeight();

         // resize the bit map
         //matrix.postScale(scaleWidth, scaleHeight);

         // rotate the Bitmap
         Matrix matrix = new Matrix();
         matrix.postRotate(degrees);             
         // create the new Bitmap                         
         Bitmap rotatedBitmap = Bitmap.createBitmap(bitmap, 0, 0, width, height, matrix, true);                 

         imageAsset.setImageBitmap(rotatedBitmap);

         // clean up 
         bitmap = null;
         rotatedBitmap = null;
         matrix = null;

     }catch(Exception e){
        utility.logError(this,"{"+CLASS_NAME+"}[rotateImage] Error:  "+e.getMessage());         
     }
 }
  • 1 1 Answer
  • 1 View
  • 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-25T18:26:45+00:00Added an answer on May 25, 2026 at 6:26 pm

    Probably put of memory error. The available heap depends on the type of phone. Even though the bitmaps are stored in native memory (which makes their memory consuption harder to track) they are limited to the same heap size. Big bitmaps (from a 5MP) camera easily use up all the memory in an app.
    You would have to post your error log to be sure though.

    For starters:
    – use smaller images

    • to clean up bitmaps use bitmap.recycle();

    Edit:
    ok, thinking about it im pretty sure it’s the out-of-memory. That’s why the error doesn’t get caught, because it happens in native code.

    This is what you do:

    When you decode your image resample it to a smaller size:

    BitmapFactory.Options resample = new BitmapFactory.Options();
    resample.inSampleSize = 4;  // whatever number seems apropriate 4 means 1/4 of the original
    bitmap = BitmapFactory.decodeFile(imageFile, resample);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Android app that allows the user to record data (such as
I have an Android app that I allow users to have a password in
I have a mobile website that allows users to upload photos using the file
I have an app that allows the user to take and save a new
I have an Android app that I had working a few months ago which
I have an Android app that begins by displaying a dialog. When I set
I started developing an android app that have to interact with MMS attachements, in
I have a dialog in an Android app that I don't want the user
Lets say you have a web app related Android app that requires the user
I have a custom view in my Android App that uses a ScaleGestureDetector.SimpleOnScaleGestureListener to

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.