Code example for ExifInterface

Methods: getAttributeInt

1
            } finally { 
            	c.close();
            } 
        } else if (uri.getScheme().equals("file")) {
            try { 
                ExifInterface exif = new ExifInterface(uri.getPath());
                int rotation = (int) PhotoTaker.exifOrientationToDegrees(
                        exif.getAttributeInt(ExifInterface.TAG_ORIENTATION,
                                ExifInterface.ORIENTATION_NORMAL));
                return rotation;
            } catch (IOException e) {
                Log.e(TAG, "Error checking exif", e);
            } 
        } 
	    return 0f; 
	} 
 
	private static float exifOrientationToDegrees(int exifOrientation) {
        if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_90) {
            return 90;