I have invoked the built-in Camera application in android 2.1 using intent. I've used the following code:
Intent cameraintent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
File file = new File(Environment.getExternalStorageDirectory(), "MyTestFile.jpg");
cameraintent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
outputFileUri = Uri.fromFile(file);
startActivityForResult(cameraintent, CAMERA_PIC_REQUEST);
To get the orientation of the captured image I've used the following code:
Uri capturedImage = outputFileUri;
Bitmap theBmp = MediaStore.Images.Media.getBitmap(getContentResolver(), capturedImage);
int img_orient=0;
String[] projection = { MediaStore.Images.Media.ORIENTATION };
Cursor mImageCursor = managedQuery(capturedImage, projection, null, null, null);
I am not able to get the orientation of captured photo as the cursor mImageCursor
is always null. What is problem in my code?