[android-developers] CameraSurfaceView and how surfaceCreated() gets called - Can someone please help me?
I have some questions regarding code below for camera preview applicaiton. Can someone please help me out? 1. How does surfaceCreated get called? From SDK, it is called immediately after the surface is first created, but I still don't know who creates this surface? 2. Why do we need to set it as SURFACE_TYPE_PUSH_BUFFERS? 3. How does this surface relate to the preview buffers? Are the preview buffers allocated by the Camera Service during startPreview? private class CameraSurfaceView extends SurfaceView implements SurfaceHolder.Callback { private SurfaceHolder mHolder; private Camera camera = null; public CameraSurfaceView(Context context) { super(context); mHolder = getHolder(); mHolder.addCallback(this); mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); } public void surfaceCreated(SurfaceHolder holder) { camera = Camera.open(); try { camera.setPreviewDisplay(mHolder); } catch (Exception e) { Log.e(Camera, Failed to set camera preview display, e); } } } Thank you very much for your help. an -- 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
Re: [android-developers] CameraSurfaceView and how surfaceCreated() gets called - Can someone please help me?
android-newbie wrote: 1. How does surfaceCreated get called? From SDK, it is called immediately after the surface is first created, but I still don't know who creates this surface? Android does, as part of setting up the SurfaceView after your onCreate() method returns. 2. Why do we need to set it as SURFACE_TYPE_PUSH_BUFFERS? SurfaceView has multiple roles (e.g., OpenGL). Push buffers is one used by various things (camera, video playback) that allow low-level code to write to the screen. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android 1.6 Programming Books: http://commonsware.com/books -- 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