How can I implement the Android camera to take photos in any screen orientation?

Public void surfaceCreated(SurfaceHolder holder) { try { camera. SetPreviewDisplay(holder); camera. SetPreviewCallback(this); } catch (IOException e) { e.printStackTrace(); } Size previewSize = camera.getParameters().getPreviewSize(); float aspect = (float) previewSize.

Width / previewSize. Height; int previewSurfaceWidth = preview.getWidth(); int previewSurfaceHeight = preview.getHeight(); LayoutParams lp = preview.getLayoutParams(); if (this.getResources(). GetConfiguration().

Orientation! = Configuration. ORIENTATION_LANDSCAPE) { // ïîðòðåòíûé âèä camera.

SetDisplayOrientation(90); lp. Height = previewSurfaceHeight; lp. Width = (int) (previewSurfaceHeight / aspect); } else { camera.

SetDisplayOrientation(0); lp. Width = previewSurfaceWidth; lp. Height = (int) (previewSurfaceWidth / aspect); } preview.

SetLayoutParams(lp); camera.startPreview(); } try this. But I think it's bug. I have this problem too.

But in my situation I can't find anything. Thic code can be correct and maybe must help you when you using camera preview. If not - this code not help u.Im used without camera so- it's not help me.

Unfortunately, setDisplayOrientation only works for API level 8 and above: link – EricB Mar 24 at 4:24.

If you don't want the preview also to rotate then set the orientation to landscape or portrait mode in your manifest file. To get correctly rotated images you need to call the setRotation() (API level 5) on the camera parameter and then set that parameter just before you call the takePicture API. You will also need to use orientationEventListener Sample code here.

This code can be correct and maybe must help you when you using camera preview. If not - this code not help you. I'm using without camera so it's not helping me.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions