I have included the camera functionality in my application. I have also launched the app in the market. I got an error message from one of the users that he is getting an er
It is failing because not all devices support arbitrary preview sizes. Apparently some do but you can't rely on it. In your surfaceChanged method you need to do something like this:
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
Camera.Parameters parameters = camera.getParameters();
List<Camera.Size> previewSizes = parameters.getSupportedPreviewSizes();
// You need to choose the most appropriate previewSize for your app
Camera.Size previewSize = // .... select one of previewSizes here
parameters.setPreviewSize(previewSize.width, previewSize.height);
camera.setParameters(parameters);
camera.startPreview();
}
You'll have to figure out a way to scale this so that you don't lose the aspect ratio etc.
For reference here is the Android SDK doc.