private final ImageReader.OnImageAvailableListener mOnImageAvailableListener
= new ImageReader.OnImageAvailableListener() {
@Override
public void onImageAvailable(ImageReader reader) {
Image img = reader.acquireNextImage();
ByteBuffer buffer = img.getPlanes()[0].getBuffer();
byte[] bytes = new byte[buffer.remaining()];
buffer.get(bytes);
img.close();
mBackgroundHandler.post(new ImageSaver(bytes, mFile));
}
};
Images are getting saved 10 times when I press capture once , i am stuck here
case STATE_WAITING_LOCK: {
Integer afState = result.get(CaptureResult.CONTROL_AF_STATE);
if (afState == null) {
mState = STATE_PICTURE_TAKEN;
captureStillPicture();
}
notice mState = STATE_PICTURE_TAKEN , this solved my problem