android-camera2image-readergetbuffer

Can I getBuffer after image.close?


I camera2 api, I save continuously image to Image[] and when want to capture picture, I call image.getPlanes()[0].getBuffer but app crashed and show error:

Image is already close.

How can I getBuffer after image.close ? Thank you!


Solution

  • You can't.

    Don't call close() on the Image before you're done using it.

    This may require you to increase the maxImageCount argument to your ImageReader, so you can hold on to more Images at the same time.