Hi I am using ACTION_IMAGE_CAPTURE for capturing image using Intent as follows:
Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
cameraIntent.putExtra(
MediaStore.EXTRA_OUTPUT, (new File(Environment.getExternalStorageDirectory(),
String.valueOf(System.currentTimeMillis()) + ".jpg"))
);
startActivityForResult(cameraIntent, 0);
I need to store image in an sdcard and retrieve the path of that image using the onActivityResult method. I don’t know how to get the image path of the currently captured image.
If any one knows please help.
Thanks
This is how it works on 2.2 (different than on previous versions). When starting intent
you need to remember
mCapturedImageURI.When you capture image, in
onActivityResult()use that URI to obtain file path:UPDATE: On new Android devices you would not need MediaStore.EXTRA_OUTPUT, but you rather deduce image/video URI from data.getData() received from onActivityResult(…, Intent data), as nicely described under
Android ACTION_IMAGE_CAPTURE Intent
However, since this part is subject to manufacturer adaptation, you may still encounter phones where “old” approach may be useful.