Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>it looks to me that the issue is that you're running out of memory because of the great consumption which is usual image processing app. The bitmap what you get after the picture might be much bigger than you actually need to show it on the screen.</p> <p>Here are some ideas to optimize memory:</p> <ol> <li>use a less memory expensive Bitmap format, i.e. Bitmap.Config.RGB_565</li> <li>use BitmapOptions and then decode your stream of bytes reusing a preallocated Bitmap within inBitmap when you know that you're using the same sizes.</li> <li>use BitmapOptions and use an inSampleSize bigger than 1</li> </ol> <p>Other ideas to solve your issue, but not related to memory consumption 4. take pictures at lower resolution changing the CameraParameters; 5. use the <a href="http://developer.android.com/reference/android/hardware/Camera.html#setOneShotPreviewCallback%28android.hardware.Camera.PreviewCallback%29" rel="nofollow noreferrer">setOneShotPreviewCallback</a> (I assume that you still take picture and use onPictureTaken) although it may happen (depending on the device and on camera parameters) that what you see on the display is not what it's actually taken on the picture.</p> <p>Here is the <a href="http://developer.android.com/reference/android/graphics/BitmapFactory.Options.html" rel="nofollow noreferrer">doc</a>:</p> <p>A quick example of BitmapOptions usage // Somewhere at the beginning of the activity Camera.Parameters params = this.camera.getParameters(); Size pictureSize = params.getPictureSize();</p> <pre><code>this.bitmapOptions = new BitmapFactory.Options(); this.bitmapOptions.inPreferredConfig = Bitmap.Config.RGB_565; this.bitmapOptions.inSampleSize = 2; this.bitmapOptions.inBitmap = Bitmap.createBitmap(pictureSize.width, pictureSize.height, Bitmap.Config.RGB_565); // In onPictureTaken function BitmapFactory.decodeByteArray(data, 0, data.length, bitmapOptions); </code></pre> <p>Regarding your issue of 90 degrees orientation: it may be due to a specific device behaviour <a href="https://stackoverflow.com/questions/4645960/how-to-set-android-camera-orientation-properly">How to set Android camera orientation properly?</a> but it would be nice if you can provide more details.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload