Question

The format of my app is all in portrait mode. Oddly, when I snap a photo in portrait mode, it is displayed on the ImageView sideways (like it was snapped in landscape)...the only way it is displayed right side up is if I snap the pic in landscape mode.

Anyone know of a simple workaround that displays the photo ride side up, regardless of the camera's orientation? I can easily provide my code if anyone needs to take a look.

Thanks!

Was it helpful?

Solution

Here is the code I used onActivityResult() in my activity. The intent returned was for picking an image of the type image/*. Works well for me!

Uri imageUri = intent.getData();
String[] orientationColumn = {MediaStore.Images.Media.ORIENTATION};
Cursor cur = managedQuery(imageUri, orientationColumn, null, null, null);
int orientation = -1;
if (cur != null && cur.moveToFirst()) {
    orientation = cur.getInt(cur.getColumnIndex(orientationColumn[0]));
}  
Matrix matrix = new Matrix();
matrix.postRotate(orientation);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top