Java tutorial
//package com.java2s; //License from project: Apache License import android.media.ExifInterface; import android.net.Uri; import java.io.IOException; public class Main { public static int getOrientation(final Uri photoUri) { ExifInterface exifInterface = null; try { exifInterface = new ExifInterface(photoUri.toString()); } catch (IOException e) { e.printStackTrace(); } return exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION, -1); } }