I am stuck with a problem, when capturing image via intent.
I am using the default intent code for capturing image. as follows.
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent, TAKE_PHOTO_CODE);
and receiving it in onActivityResult as follow.
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if( TAKE_PHOTO_CODE==requestCode){
try {
Bundle extras = data.getExtras();
Bitmap mImageBitmap = (Bitmap) extras.get("data");
selectedImagePath = saveImageInfo(mImageBitmap, "image");
ExifInterface exif = new ExifInterface(selectedImagePath);
Toast.makeText(getBaseContext()," "+exif.getAttribute(ExifInterface.TAG_ORIENTATION), Toast.LENGTH_SHORT).show();
try {
showDialog(DIALOG_UPLOADING);
} catch (Exception e) {
e.printStackTrace();
}
} catch (Exception e) {
e.printStackTrace();
Toast.makeText(getApplicationContext(), "No image selected.. ", Toast.LENGTH_SHORT).show();
}
}
}
I want the captured image orientation in this onActivityResult method, i have search and about it and found the ExifInterface, but it does not work for me, I am testing on LG Optimus Android device, it always returns 0 for me.
The problem is after capturing image it is rotated. Any Solution?