I am reading the code about Android Camera2 APIs from here: https://github.com/googlesamples/android-Camera2Basic
And it is confusing in this lines: https://github.com/googlesamples/android-Camera2Basic/blob/master/Application/src/main/java/com/example/android/camera2basic/Camera2BasicFragment.java#L570-L574
that the previewRequest builder only add surface, which is the TextureView to show, as target. But the following line actually add both as the targets. As I understand, this should not fire the "OnImageAvailable" Lisenter during preview, no? So why this add the imagereader's surface here?
I tried to removed this imagereader's surface here but got error when I really want to capture an image.....
SOOO CONFUSING!!!
ImageReaderis used to get captured image data to save in a file. And the surface ofImageReadermust be added toCaptureSessionbefore you useCaptureRequest.Builderto capture image, according to doc