dimanche 24 mai 2015

get image uri from Intent(MediaStore.ACTION_IMAGE_CAPTURE)

Hi when I do something like this

 Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

    if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
        startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE);
    }

In onActivityResult I get thumbnail of the image from the data intent from the camera app

Bundle extras = data.getExtras();
Bitmap imageBitmap = (Bitmap) extras.get("data");
mImageView.setImageBitmap(imageBitmap);

And I use that bitmap something like this.

But What if I want the imageuri so that I can get the full size image from it. I tried getting the image uri from the intent something like above

            Uri uri = data.getData();
            if (uri != null) {
                Log.d(TAG, uri.toString());
            }else{
                Log.d(TAG,"uri is null");
            }

Doing like this I get uri is null in my logcat.So can anyone let me know how to get the image uri.I dont want to use EXTRA_OUTPUT and specify my own path.Thanks in advance

Aucun commentaire:

Enregistrer un commentaire