In my application I get image URLs from web service and show them in ImageView. Some of the images are being shown rotated by 90, 180 or 270 degrees.
I have tried to get orientation from EXIF
ExifInterface exif = null;
try {
exif = new ExifInterface(path);
} catch (IOException e) {
e.printStackTrace();
}
int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION,
ExifInterface.ORIENTATION_UNDEFINED);
but this orientation is always 0. I also tried this
Cursor cursor = context.getContentResolver().query(photoUri,
new String[]{MediaStore.Images.ImageColumns.ORIENTATION}, null, null, null);
but the cursor is being null.
So how can I get image orientation from it's path in server? Thanks.