0

I am using the built-in camera in my Android app and having problems getting the path to the last captured image.

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    ....
}

Intent data contains a thumbnail of the last captured image, not the actual image saved to the SD card. So, how do I get the path to the actual full size image?

Thanks in advance.

Faizal
  • 783
  • 1
  • 6
  • 23
petermk
  • 757
  • 1
  • 6
  • 18

1 Answers1

0

This SO answer is probably what you are looking for:

How to pick an image from gallery (SD Card) for my app?

Alternatively, you could set the path for the picture manually before starting the Camera activity. You could add this path like this:

cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(FILE_PATH));

Then on the result, you check if the resultCode is RESULT_OK, and use the path of the image you already know.

Community
  • 1
  • 1
Jan S.
  • 10,328
  • 3
  • 31
  • 36
  • Oh, I do know about MediaStore.EXTRA_OUTPUT solution, but that way I'd have to save an extra copy of the image on the SD card and then delete it when I am done processing it. – petermk Oct 30 '11 at 07:17
  • What about the answer I linked to, isn't that what you want? – Jan S. Oct 30 '11 at 15:47
  • Wouldn't I have to open the gallery that way and make the user pick an image? – petermk Oct 30 '11 at 15:50
  • requestCode might be a different one but the rest of the code should work. – Jan S. Nov 01 '11 at 01:55
  • I just stumbled upon this: http://stackoverflow.com/questions/1910608/android-action-image-capture-intent/1932268#1932268 It looks like there is a bug with certain Android devices, you might be careful, or just save the image to a specific path that you know. – Jan S. Nov 01 '11 at 02:14