Android Camera Set Resolution


I have built a custom Camera App and I am trying to change the resoloution of the image that is took. I have read around that this could depend on the phone or version of Android?

I know they are set using the setParameters but just dont know how to set the actuall resoloution to work on all phones. I am wanting it to be kind of small as my app force closes otherwise. When I use a test picture at 640×348 this works so around that size/resoloution would be perfect.

It may be easier to use setPictureSize?

public void surfaceCreated(SurfaceHolder holder) {
    // TODO Auto-generated method stub
    camera =;
    try {
           Camera.Parameters parameters = camera.getParameters();
           if (this.getResources().getConfiguration().orientation != Configuration.ORIENTATION_LANDSCAPE) {
              parameters.set("orientation", "portrait");
              // Uncomment for Android 2.0 and above
           } else {
              parameters.set("orientation", "landscape");
              // Uncomment for Android 2.0 and above
      } catch (IOException exception) {

Best Solution

There is no setResolution(), only setPictureSize(). Use getSupportedPictureSizes() on Camera.Parameters to find the size you want, or use that information to populate a ListView or Spinner or something for the user to choose the desired size. Here is a sample project recently updated to use getSupportedPictureSizes() to find the smallest supported resolution and use that.