Hi,
you have to implement the onTakenPicture() to make it works. you
should look at the android documentation it is pretty well explained.


On Nov 14, 7:12 am, saex <[email protected]> wrote:
> I have a CustomCameraView, and i need to add a function that when i
> call it, the cameraview must capture a photo into a bitmap and into a
> file. The photo must be taken with default cuality, because this app
> must be executed on different Android phones with different cameras
> and so versions.
>
> Code examples/tutorials will be apreciated. I didn't find a easy
> working way to do it after hours of searching on google.
>
> This is my customCameraView:
>
>     public class CustomCameraView extends SurfaceView
>     {
>         SurfaceHolder previewHolder;
>         Camera camera;
>         public CustomCameraView(Context ctx)
>         {
>            super(ctx);
>            previewHolder = this.getHolder();
>
> previewHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
>            previewHolder.addCallback(surfaceHolderListener);
>         }
>         SurfaceHolder.Callback surfaceHolderListener = new
> SurfaceHolder.Callback()
>         {
>            public void surfaceCreated(SurfaceHolder holder)
>            {
>                    camera=Camera.open();
>                    try {
>                    camera.setPreviewDisplay(previewHolder);
>                    }catch (Exception E ){ }
>            }
>            public void surfaceDestroyed(SurfaceHolder arg0)
>            {
>                    camera.stopPreview();
>                    camera.release();
>            }
>            public void surfaceChanged(SurfaceHolder holder, int format,
> int width, int height)
>            {
>                    Parameters params = camera.getParameters();
>                    params.setPreviewSize(width, height);
>                    params.setPictureFormat(PixelFormat.JPEG);
>                    camera.setParameters(params);
>                    camera.startPreview();
>            }
>         };
>     }

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to