Java tutorial
//package com.java2s; //License from project: Open Source License 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 photoUri) { int orientation = 0; Cursor cursor = context.getContentResolver().query(photoUri, new String[] { MediaStore.Images.ImageColumns.ORIENTATION }, null, null, null); if (cursor != null) { if (cursor.getCount() != 1) { return -1; } cursor.moveToFirst(); orientation = cursor.getInt(0); cursor.close(); } return orientation; } }