Code example for ExifInterface

Methods: getAttribute

0
    private ExifUtils() { 
    } 
 
    public static int getExifRotation(String imgPath) {
        try { 
            ExifInterface exif = new ExifInterface(imgPath);
            String rotationAmount = exif.getAttribute(ExifInterface.TAG_ORIENTATION);
            if (!TextUtils.isEmpty(rotationAmount)) {
                int rotationParam = Integer.parseInt(rotationAmount);
                switch (rotationParam) {
                    case ExifInterface.ORIENTATION_NORMAL:
                        return 0; 
                    case ExifInterface.ORIENTATION_ROTATE_90:
                        return 90; 
                    case ExifInterface.ORIENTATION_ROTATE_180:
                        return 180; 
                    case ExifInterface.ORIENTATION_ROTATE_270:
                        return 270; 
                    default: 
                        return 0; 
Connect your IDE to all the code out there  Get Codota for Java