Get Location of Saved Camera Picture

Ask by : Get Off My Lawn November 04, 2012 04:16

Okay, so I have an onclick on a button that opens the camera, when I take a picture and save it how do I get the file name+location of where it was saved to open it in my app?

Here is my button click

Button btncamera = (Button)findViewById(;
btncamera.setOnClickListener(new OnClickListener(){
    public void onClick(View v){
        Intent cameraIntent = nwe Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        startActivityForResult(cameraIntent, 2500);

Here is my Result it doesn't contain anything, but it will start another Intent to display the image:

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


Maybe I am doing it wrong, but any guidance would be much appreciated thanks!

View original question

Answer by : Matt ClarkNovember 04, 2012 04:16

Try adding this to your onActivityResult.

Bitmap picture = (Bitmap) data.getExtras().get("data");

Take the image out of the camera intent, create a bitmap out of it, and then use it from there. Write it to a file, or import it directly into a display resource. Also be sure to check your ResultCode to determine if a picture actually has been taken.

View original answer