title: android rotate image crashes only on certain phones
body: <p>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.</p>
  
  <pre><code>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());         
       }
   }
  </code></pre>