I ran into the same problem a while ago, and it turned out to be related to camera resolution. Most likely, your Camera initialized with the highest resolution available, which can slow down performance during preview. Try setting a picture size below with something like this .-
Camera.Parameters params = camera.getParameters(); params.setPictureSize(1280, 960); camera.setParameters(params);
Please note that you need to set the available image size. You can check the available sizes with
camera.getParameters().getSupportedPictureSizes();
Hope this helps.
EDIT
It seems that the image size is used with a different aspect ratio than the standard, and slows down. This is how I choose pictureSize .
First, I get the default aspect ratio of the camera pictureSize
Camera.Parameters params = camera.getParameters(); defaultCameraRatio = (float) params.getPictureSize().width / (float) params.getPictureSize().height;
And then I get a lower pictureSize that matches the same ratio.
private Size getPreferredPictureSize() { Size res = null; List<Size> sizes = camera.getParameters().getSupportedPictureSizes(); for (Size s : sizes) { float ratio = (float) s.width / (float) s.height; if (ratio == defaultCameraRatio && s.height <= PHOTO_HEIGHT_THRESHOLD) { res = s; break; } } return res; }
Where PHOTO_HEIGHT_THRESHOLD is the maximum height you want to allow.
source share