tags:

views:

398

answers:

1

Dear,

currently i am using android Api 4. my camera initializing code is follow:

public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
  // Now that the size is known, set up the camera parameters and begin
  // the preview.
  Parameters parameters = camera.getParameters();
  parameters.set("jpeg-quality", 100);
  parameters.set("orientation", "portrait");
  parameters.set("picture-size", "320X430");
  parameters.set("rotation", 0);
  parameters.setPictureFormat(PixelFormat.JPEG);
  camera.setParameters(parameters);
  camera.startPreview();

 }

i set the orientation portrait, camera preview working appropriately. but when i captured the image ,its rotating the image with 90 degree.In the landscape orientation its working perfectly. so how i can capture normal image using portrait orientation.

thanks.

A: 

Does your activity have an orientation specified? I'm not sure, but the problem might be that if your activity automatically rotates when the phone is held sideways, then that might conflict with your settings above. If that's the problem, try setting android:screenOrientation="portrait" in the Android Manifest, or by using setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_...)

Steve H