public static ViewOrientation ofExif(final int orientation) {
        switch (orientation) {
            case ExifInterface.ORIENTATION_ROTATE_90: // 6
                return new ViewOrientation(90, false);
            case ExifInterface.ORIENTATION_ROTATE_180: // 3
                return new ViewOrientation(180, false);
            case ExifInterface.ORIENTATION_ROTATE_270: // 8
                return new ViewOrientation(270, false);
            case ExifInterface.ORIENTATION_FLIP_HORIZONTAL: // 2
                return new ViewOrientation(0, true);
            case ExifInterface.ORIENTATION_FLIP_VERTICAL: // 4
                return new ViewOrientation(180, true);
            case ExifInterface.ORIENTATION_TRANSPOSE: // 5
                return new ViewOrientation(270, true);
            case ExifInterface.ORIENTATION_TRANSVERSE: // 7
                return new ViewOrientation(90, true);
            case ExifInterface.ORIENTATION_NORMAL: // 1
            default:
                return new ViewOrientation(0, false);
        }
    }
Create orientation from an exif value, which is usually obtained from image metadata using ExifInterface
main/src/main/java/cgeo/geocaching/utils/ViewOrientation.java