开发者

Getting camera to always return a snapped photo right side up?

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 ca开发者_如何学编程mera's orientation? I can easily provide my code if anyone needs to take a look.

Thanks!


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);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜