Question: I'm making an app to take photos, but I don't want to use `startActivityForResult`.

I'm using `SurfaceView` and `PictureCallback()`

But the problem is, the photo is always with `320x240px`

Here is the code:

```
PictureCallback myPictureCallback_JPG = new PictureCallback(){

    public void onPictureTaken(byte[] arg0, Camera arg1) {       

      Uri uriTarget = getContentResolver().insert(Media.EXTERNAL_CONTENT_URI, new ContentValues());

      OutputStream imageFileOS;

      try {

       imageFileOS = getContentResolver().openOutputStream(uriTarget);
       imageFileOS.write(arg0);
       imageFileOS.flush();
       imageFileOS.close();

       Toast.makeText(MainActivity.this,"Image saved: " + uriTarget.toString(),Toast.LENGTH_LONG).show();

      } catch (FileNotFoundException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
      } catch (IOException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
      }

      camera.startPreview();
     }
};

```

How can I "say to camera" to take in the best resolution available?

Anyway, thakyou (:

Answer: 
JpeqQuality is about compression, but camera parameters seems to be the right pointer

You can get current params from the camera

```
Camera.Parameters parameters = camera.getParameters();

```

And then enforce size for preview / picture

```
parameters.setPreviewSize(previewWidth, previewHeight);
parameters.setPictureSize(newWidth, newHeight);
// push it back to camera
camera.setParameters(parameters);

```

NB don't forget to check whether the size is supported by the camera on your phone as it's very device specific

<http://developer.android.com/reference/android/hardware/Camera.Parameters.html#getSupportedPictureSizes>()
On the onPictureTaken callback method, the picture is already taken, so there's nothing to do there. 

You set the parameter after you have instantiated the Camera object, trough the setParameters method. Have a look to the [Camera.Parameters](http://developer.android.com/reference/android/hardware/Camera.Parameters.html) class. I think the method [setJpegQuality](http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setJpegQuality%28int%29) may interest you.

Basically, I think it should be something like this:

```
Camera camera= Camera.open();
camera.getParameters().setJpegQuality(100); // being 100 the max quality and 0 the min

```