Reputation: 771
I have a camera preview that I have successfully been able to take pictures from using Camera.takePicture()
.
However now I am adding a separate option to pause the preview on demand currently by simply calling camera.stopPreview()
However I still want be able to capture what is on the screen (but not my controls, buttons etc).
Is there anyway of doing that or another way to pause/freeze the camera
?
Upvotes: 2
Views: 1892
Reputation: 4185
You can save the data returned in each call of the preview callback.
PreviewCallback pcb = new PreviewCallback() {
public void onPreviewFrame(byte[] data, Camera arg1) {
bitmap = BitmapFactory.decodeByteArray(data, 0, data.length);
//bitmap is a static Bitmap
}
}
I don't know how much this will affect the frame rate before you call stopPreview()
.
After the stopPreview()
call, bitmap contains the last frame that was captured.
Upvotes: 1