Change camera resolution setting programmatically in android

SANDHYA picture SANDHYA · Jun 13, 2012 · Viewed 33.6k times · Source

I'm using the below code to open the camera. Is it possible to set the camera resolution to high programmatically?

private void openDefaultCameraApp() {
    Intent i = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
    startActivityForResult(i, CAPTURE_PHOTO_CONSTANT);
}

Answer

Zaid Daghestani picture Zaid Daghestani · Jun 13, 2012

You must add an MediaStore.EXTRA_OUTPUT to the intent. In the extra, you have to specify a Uri for the picture to be saved to. This will save the full resolution image, otherwise, it will just snap a small image.

Refer to the Android docs: ACTION_IMAGE_CAPTURE

Standard Intent action that can be sent to have the camera application capture an image and return it. The caller may pass an extra EXTRA_OUTPUT to control where this image will be written. If the EXTRA_OUTPUT is not present, then a small sized image is returned as a Bitmap object in the extra field. This is useful for applications that only need a small image. If the EXTRA_OUTPUT is present, then the full-sized image will be written to the Uri value of EXTRA_OUTPUT