Hi there,
I need to capture an image from camera and display on surfaceview for
my project. I am trying to obtain bitmap from data in onPreviewFrame
method of previewCallback and display on surface using canvas.
Can someone please help me?
Following steps were done:
- created a Preview class extending SurfaceView and implementing
SurfaceHolder.Callback set it as the content of activity.
- installed a SurfaceHolder.Callback in my Preview to get notified
when the underlying surface is created and destroyed.
mHolder = getHolder();
mHolder.addCallback(this);
//mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
- started a thread in surfaceCreated method described as follows:
public void run() {
// Open the Camera
camera = Camera.open();
if (camera != null) {
try {
camera.setPreviewDisplay(mHolder);
} catch (IOException e) {
// TODO Auto-generated
catch block
e.printStackTrace();
}
camera.startPreview();
ImageCaptureCallback iccb = new
ImageCaptureCallback ();
camera.setPreviewCallback(iccb);
}
----------
public class ImageCaptureCallback implements PreviewCallback {
public void onPreviewFrame(byte[] data, Camera camera) {
//ToDo
}
Please help. I can explain my problem in detail if anybody wish to
solve it....
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---