0

I want to get Full size image from camera intent.I have tried bellow code but i getting image size very small.following is my code

Intent intent=new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent , PICK_IMAGE_REQUEST2);

onActivityResult code

    if(requestCode == PICK_IMAGE_REQUEST2)
    {
        //filePath = data.getData();
        bitmap = (Bitmap) data.getExtras().get("data");
        iv_upload.setImageBitmap(bitmap);
        check=true;

        // CALL THIS METHOD TO GET THE URI FROM THE BITMAP
        filePath = getImageUri(getApplicationContext(), bitmap);
    }
Ratilal Chopda
  • 4,162
  • 4
  • 18
  • 31
ajay dhadhal
  • 306
  • 4
  • 16
  • 2
    this has been answered multiple times. https://stackoverflow.com/questions/6448856/android-camera-intent-how-to-get-full-sized-photo?rq=1 https://stackoverflow.com/questions/9700731/how-to-get-full-size-bitmap-from-camera?rq=1 – Robert Estivill Nov 08 '17 at 12:34

1 Answers1

4

By doing this you get the thumb preview as mentioned here

 data.getExtras().get("data");

If you want the full size, you need to create a collision-resistant file name and invoke your intent like this

Uri photoURI = FileProvider.getUriForFile(this,
                                          "com.example.android.fileprovider",
                                          photoFile);

takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);

startActivityForResult(takePictureIntent, REQUEST_TAKE_PHOTO);

Here's the full example

Victor Hugo Montes
  • 1,270
  • 1
  • 17
  • 28