0

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.

Community
  • 1
  • 1
Madhur Rampal
  • 541
  • 3
  • 9
  • 21
  • or this [http://mobisocial.stanford.edu/news/2011/08/rotating-images-in-android/](http://mobisocial.stanford.edu/news/2011/08/rotating-images-in-android/) – sschrass May 21 '12 at 13:45
  • Here's my solution to this issue; http://stackoverflow.com/a/8864367/137404 – Tolga E Jul 16 '12 at 17:33

2 Answers2

0

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

Community
  • 1
  • 1
MNRSullivan
  • 587
  • 7
  • 18
  • i tried getResources().getConfiguration().orientation. But still same result 1 on both devices. – Madhur Rampal May 21 '12 at 13:47
  • What exactly do you want to do? Because if you just want to set the orientation, instead of checking what the orientation currently is, that should be a little easier. – MNRSullivan May 21 '12 at 14:13
0

what happens if you:

ExifInterface exif = new ExifInterface("filepath");
exif.getAttribute(ExifInterface.TAG_ORIENTATION);

?

sschrass
  • 7,014
  • 6
  • 43
  • 62
  • It always give 0 in both devices. Nexus which shows fine and Nexus S which shows image in landscape or rotates image. – Madhur Rampal May 22 '12 at 05:48
  • have you read over this: http://stackoverflow.com/questions/8450539/images-taken-with-action-image-capture-always-returns-1-for-exifinterface-tag-or/8864367#8864367 ? – sschrass May 22 '12 at 06:22
  • It seems that there is a bug explaining your mentioned behaviour of the exif tag. – sschrass May 22 '12 at 06:29
  • Yeah! i read that. But it is giving runtime error on this line Cursor mediaCursor = content.query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, new String[] {MediaStore.Images.ImageColumns.ORIENTATION, MediaStore.MediaColumns.SIZE }, MediaStore.MediaColumns.DATE_ADDED + ">=?", new String[]{String.valueOf(captureTime/1000 - 1)}, MediaStore.MediaColumns.DATE_ADDED + " desc"); – Madhur Rampal May 22 '12 at 10:14
  • have you mor information about this? a Stacktrace? Maybe you are just missing a permission. – sschrass May 22 '12 at 10:41