Java tutorial
//package com.java2s; import android.content.Context; import android.database.Cursor; import android.net.Uri; import android.provider.MediaStore; public class Main { public static int getOrientation(Context context, Uri contentUri) { Cursor cursor = context.getContentResolver().query(contentUri, new String[] { MediaStore.Images.ImageColumns.ORIENTATION }, null, null, null); try { if (cursor.moveToFirst()) { return cursor.getInt(0); } else { return -1; } } finally { cursor.close(); } } }