Hi everyone! I'm currently trying to build an android application to take pictures and I need to freeze the camera preview on a given event (i.e. picture taken) and restart it only after another event.
What I want, in other words, is for the view to display whatever the camera sees until the freeze event occurs and then to freeze the image (i.e. display whatever was on screen at the time of this event -- as if a picture was taken) until the unfreeze event occurs. Now, I'm currently using a SurfaceView with a SurfaceHolder.Callback to do this and I tried to use a PreviewCallback to freeze the screen, but unfortunately, I can't find an example or a tutorial and I'm really stuck at this point. If anyone has a guide or some pointers on how to get this done, I would really appreciate the help... I'm pasting the relevant parts of my code below: public class CustomCameraView extends SurfaceView { Camera camera; SurfaceHolder previewHolder; //Callback for the surfaceholder SurfaceHolder.Callback surfaceHolderListener = new SurfaceHolder.Callback() { public void surfaceCreated(SurfaceHolder holder) { camera=Camera.open(); try { camera.setPreviewDisplay(previewHolder); } catch (Throwable t) { } } public void surfaceChanged(SurfaceHolder surfaceHolder, int format, int w, int h) { Parameters params = camera.getParameters(); params.setPictureFormat(PixelFormat.JPEG); camera.setParameters(params); camera.startPreview(); } public void surfaceDestroyed(SurfaceHolder arg0) { camera.stopPreview(); camera.release(); } }; public CustomCameraView(Context ctx) { super(ctx); previewHolder = this.getHolder(); previewHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); previewHolder.addCallback(surfaceHolderListener); setBackgroundColor(Color.TRANSPARENT); } public CustomCameraView(Context context, AttributeSet attrs) { super(context, attrs); } protected void onDraw (Canvas canvas) { } public void closeCamera() { if(camera != null) camera.release(); } public void dispatchDraw(Canvas c) { super.dispatchDraw(c); } } Thank you very much for your help! -Billy -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en