Ok, I tried that but then I didn't know how to get the surfaceholder where to start the preview of my camera because I'm extending from surfaceview.
Plz, help, I'm trying it since long time ago. Thks in advice :) On 9 ago, 01:02, Mark Murphy <[email protected]> wrote: > You cannot "put a button into a surfaceview". You can put the > SurfaceView and the Button in a RelativeLayout or other type of > container. > > On Sat, Aug 6, 2011 at 1:44 PM, David Sanchez de la Torre > > <[email protected]> wrote: > > Hi there, I'm trying to put a button into a surfaceview that I use for > > preview the camera. I prefer to use a xml file but when I try to get > > it through the R. etc it's impossible. Later I'll try to put an image > > into the surfaceview. > > > To sum up: I need a frame in Android to preview the camera and some > > buttons at the bottom. > > > Part of my code: > > > class Preview extends SurfaceView implements SurfaceHolder.Callback { > > > public SurfaceHolder mHolder; > > public Camera mCamera; > > Preview(Context context) { > > super(context); > > Log.d("Patata", "Entré en Preview"); > > // Install a SurfaceHolder.Callback so we get notified when > > the > > // underlying surface is created and destroyed. > > mHolder = getHolder(); > > mHolder.addCallback(this); > > mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); > > } > > > public void surfaceCreated(SurfaceHolder holder) { > > // The Surface has been created, acquire the camera and tell > > it where > > // to draw. > > Log.d("----", "Se creó el surface (saltó el gatillo)"); > > mCamera = Camera.open(); > > try { > > mCamera.setPreviewDisplay(holder); > > } catch (IOException exception) { > > mCamera.release(); > > mCamera = null; > > // TODO: add more exception handling logic here > > Log.d("----", "Excepción " + exception.toString()); > > } > > > -- > > 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 > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy > > Android 3.1 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 [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

