Once a call is made to Camera.takePicture(), my preview will stop updating as described in the docs. What\'s the best way to detect that the image capture process is finishe
Since the PictureCallback is started in a separate thread anyway (it will not lock the UI), you don't need to use an AsyncTask to call the capture.
There are two ways to do what you want to do, the easiest is the following:
mCamera.startPreview(); //preview has to be started before you can take a picture
mCamera.takePicture(null, null, mPictureCallback); //take a picture
private PictureCallback mPictureCallback = new PictureCallback() {
@Override
public void onPictureTaken(byte[] data, Camera camera) {
camera.startPreview(); //once your camera has successfully finished
//its capture it's safe to restart the preview
... //anything else you want to do to process that image
}
}
The second would be using an anonymous function, e.g.:
mCamera.takePicture(null, null, new PictureCallback(){
...
});
Both have their uses, depending on your needs.