Cursor For An Image Always Returns Null
I'm storing a picture from my Camera like this: String newName = new BigInteger(130, new SecureRandom()) .toString(24); File mydir = new File(Environment.getExt
Solution 1:
Instead of using a cursor, since you only need to find the orienataion of one image you could do this :
ExifInterface exif = new ExifInterface(selectedImage);
exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, -1);
if(orientation == 3 || orientation == 6 || orientation == 8 ){
Matrix matrix = new Matrix();
if (orientation == 6)
matrix.postRotate(90);
else if (orientation == 3)
matrix.postRotate(180);
else if (orientation == 8)
matrix.postRotate(270);
result = Bitmap.createBitmap(result, 0, 0, result.getWidth(), result.getHeight(), matrix, true); // rotating bitmap
}
Post a Comment for "Cursor For An Image Always Returns Null"