Here you can find the source of getOrientation(Context context, Uri photoUri)
public static int getOrientation(Context context, Uri photoUri)
//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 photoUri) { /* it's on the external media. */ Cursor cursor = context//from w w w. ja v a 2 s . com .getContentResolver() .query(photoUri, new String[] { MediaStore.Images.ImageColumns.ORIENTATION }, null, null, null); if (cursor.getCount() != 1) { return -1; } cursor.moveToFirst(); return cursor.getInt(0); } }