From Camera2Basic, I made a very small change that is to replace the texture surface with a dummy one:
private SurfaceTexture mDummyPreview = new SurfaceTexture(10);
private Surface mDummySurface = new Surface(mDummyPreview);
.........
mPreviewRequestBuilder.addTarget(mDummySurface);
and it doesn't work anymore. When I click "Picture" it works for the first time but then it doesn't work after that.
It is supposed to work from this os answer
Do you know why is that? What am I missing here?
UPDATED
This error keeps coming up whenever the program take the still photo:
W/Binder: Binder call failed.
java.lang.NullPointerException: Attempt to invoke virtual method 'android.hardware.camera2.CaptureRequest android.hardware.camera2.impl.CameraDeviceImpl$CaptureCallbackHolder.getRequest(int)' on a null object reference
at android.hardware.camera2.impl.CameraDeviceImpl$CameraDeviceCallbacks.onResultReceived(CameraDeviceImpl.java:1758)
at android.hardware.camera2.ICameraDeviceCallbacks$Stub.onTransact(ICameraDeviceCallbacks.java:99)
at android.os.Binder.execTransact(Binder.java:570)
Thanks.