How to get orientation of device in android?
I showing image in imageview which is captured by Intent method of android camera. I have been tested this code over Samsung Nexus but when i tested over Nexus S, image is shwoing rotated by itself on 270 degree. I have been go through these links
ACTION_IMAGE_CAPTURE orientation problem on Nexus S and Samsung Galaxy S I9000
Camera/picture orientation in Android
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setRotation%28int%29
Picture orientation from gallery/camera intent
But this code
ExifInterface exif = new ExifInterface("filepath");
exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
always giving 0 in both devices. Please tell i would i know that image is showing in which angle in particular device while showing so that it will be applied for all devices, once i will get its angle i will rotate by myself. Thanks in advance.
I'm not 100% sure I understand what you're looking for, but if you want the orientation of the device, check out this question:
Check orientation on Android phone
what happens if you:
ExifInterface exif = new ExifInterface("filepath");
exif.getAttribute(ExifInterface.TAG_ORIENTATION);
?
链接地址: http://www.djcxy.com/p/41840.html上一篇: 在Samsung Galaxy S上以纵向模式“拍照并呈现”
下一篇: 如何在android中获取设备的方向?