开发者

Why Camera.setParameters(Camera.Parameters) does not work on Sony-Ericsson X10 and Droid?

Has anyone come across a strange behaviour with the Camera API when used on Sony-Ericsson X10 or Droid?

For example the following code doesn't work on those devices. As a result I'm getting a lot of negative feedback on the Market translating into many cancelled orders...

mParame开发者_C百科ters.set("rotation", orientation);
mParameters.set("jpeg-quality", img_quality);
mParameters.set("picture-size", "1024x768");
mCamera.setParameters(mParameters);

Could you suggest an alternative way of achieving the same? Thanks.


You can't just set random values in the camera parameters because you don't know if the hardware is going to support that, so you need to ask first!

mCamera = Camera.open();
Camera.Parameters params = mCamera.getParameters();
List<Size> sizes = params.getSupportedPictureSizes();
// See which sizes the camera supports and choose one of those
mSize = sizes.get(0);
params.setPictureSize(mSize.width, mSize.height);
mCamera.setParameters(params);


You must first fix the orientation of the activity and then must put orietación grades:

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
mCamera.setDisplayOrientation(90);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜