I just want to open native camera app from my app to capture a photo and set it as a background image of my screen then rotate it onclick of button. Photo is rotating n number of times if it is taken with 3MP camera. If i set camera resolution to 5MP or more, app is force closing on click of button 5th time (photo is rotating 4 times) .
Bitmap rotatedBitmap = null;
int curAngle = 0;
private Bitmap rotateImageBitmap(Bitmap capturedPhotoBitmap) {
if(rotatedBitmap != null )
{
rotatedBitmap = null;
}
Matrix matrix = new Matrix();
curAngle = (curAngle + 90) % 360;
matrix.postRotate(curAngle);
rotatedBitmap = Bitmap.createBitmap(capturedPhotoBitmap, 0, 0, capturedPhotoBitmap.getWidth(), capturedPhotoBitmap.getHeight(), matrix, true);
return rotatedBitmap;
}
This is from Developer Guide ....
1.
Mobile devices typically have constrained system resources. Android devices can have as little as 16MB of memory available to a single application.
2. Bitmaps take up a lot of memory, especially for rich images like photographs. For example, the camera on the Galaxy Nexus takes photos up to 2592x1936 pixels (5 megapixels). If the bitmap configuration used is ARGB_8888 (the default from the Android 2.3 onward) then loading this image into memory takes about 19MB of memory (2592*1936*4 bytes), immediately exhausting the per-app limit on some devices.
Most phones nowadays have cameras 8mp or higher. so pictures will be large. How can i rotate my photo 'n' number of times without bothering of camera resolution. Do i need to compress it ? What is the best way? Please help me.