2

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.

VB4EVA
  • 81
  • 2
  • 17
  • Did you add mDummySurface to the session configuration as well? That is, to the call to CameraDevice.createCaptureSession() ? – Eddy Talvala Jan 04 '18 at 00:07
  • @EddyTalvala Yes I did. I updated the question with the error message. Do you know what that error means? Thanks. – VB4EVA Jan 06 '18 at 02:08
  • You need to include a complete logcat from a test run; it's not possible to tell what's wrong from that small snippet, unfortunately. – Eddy Talvala Jan 08 '18 at 20:16
  • hi @EddyTalvala I managed to make it work now by calling mDummyPreview.setDefaultBufferSize(). But now I encounter another problem [here](https://stackoverflow.com/questions/48198374/continuously-take-still-photo-with-android-camera2). Thanks. – VB4EVA Jan 11 '18 at 00:55
  • I the same issue, only appear on Xiaomi Mi5 (Android 7.0) – Stony Jan 22 '19 at 15:49

0 Answers0