Chulbul Pandey
Chulbul Pandey

Reputation: 506

How to capture back to back images using Camera

I have written a program, in which i am allowing user to capture an image, but once user capture an image i am not able to open camera again same time to allow user to capture more photos getting previous camera screen, to capture number of pics user has to close and then again need to open an app.

PictureCallback mPicture = new PictureCallback() {
    @Override
    public void onPictureTaken(byte[] data, Camera camera) {
        File pictureFile = getOutputMediaFile();
        if (pictureFile == null) {
            return;
        }
        try {
            FileOutputStream fos = new FileOutputStream(pictureFile);
            fos.write(data);
            fos.close();
        } catch (FileNotFoundException e) {

        } catch (IOException e) {
        }
    }
};

Upvotes: 0

Views: 195

Answers (1)

Chintan Rathod
Chintan Rathod

Reputation: 26034

You need to write following code after saving your image in PictureCallBack

camera.startPreview();

This will start preview of camera after taking picture.

Upvotes: 1

Related Questions