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