Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.media.ExifInterface;

import java.io.File;

public class Main {

    public static int getImageOrientation(String uri) {
        if (!new File(uri).exists()) {
            return 0;
        }
        try {
            ExifInterface exif = new ExifInterface(uri);
            int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
            return orientation;
        } catch (Exception e) {
        }
        return 0;
    }
}