The following code shows a vertical preview of the camera, and it works. BUT!! I get a photo in the landscape !: (
How can I build it vertically? I have a vertical preview, but I cannot save the image vertically.
greetings and thanks, Fran
Onclick
public void onClick(View arg0) { camera.takePicture(myShutterCallback, myPictureCallback_RAW, myPictureCallback_JPG); }
ANNOUNCEMENT
@Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { if (previewing) { camera.stopPreview(); previewing = false; } if (camera != null) { /* * camera.setPreviewDisplay(surfaceHolder); camera.startPreview(); * previewing = true; */ Camera.Parameters parameters = camera.getParameters(); parameters.setPreviewSize(width, height); camera.setParameters(parameters); // Condicions per utilitzar la orientacio adecuada segons el sdk if (Integer.parseInt(Build.VERSION.SDK) >= 8) setDisplayOrientation(camera, 90); else { if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { parameters.set("orientation", "portrait"); parameters.set("rotation", 90); } if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { parameters.set("orientation", "landscape"); parameters.set("rotation", 90); } camera.setParameters(parameters); } // camera.startPreview(); previewing = true; } }
TAKE A PHOTO
PictureCallback myPictureCallback_JPG = new PictureCallback() { @Override public void onPictureTaken(byte[] arg0, Camera arg1) {
source share