https://github.com/yabushi/TimeStampCamera
When you attempt to RUN the
java.lang.NullPointerException: Attempt to Invoke virtual method 'void android.graphics.SurfaceTexture.setDefaultBufferSize(int, int)' on an all object reference
at com.example.shigeki.timestampcamera.MainActivity.createCameraPreviewSession (MainActivity.java:166)
at com.example.shigeki.timestampcamera.MainActivity.access$000(MainActivity.java:32)
at com.example.shigeki.timestampcamera.MainActivity$1.onOpened (MainActivity.java:88)
at android.hardware.camera2.impl.CameraDeviceImpl $1.run (CameraDeviceImpl.java:118)
at android.os.Handler.handleCallback (Handler.java:810)
at android.os.Handler.dispatchMessage (Handler.java:99)
at android.os.Looper.loop (Looper.java:189)
at android.app.ActivityThread.main (ActivityThread.java:5529)
at java.lang.reflect.Method.invoke (Native Method)
at java.lang.reflect.Method.invoke (Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:950)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java: 745)
An error message appears with .
on MainActivity's 32,88,118
I think the error is that you are referring to an object that is Null, but
I don't know how to resolve it.
In order to avoid NPE, at least you should add a Null check.
There is a method called TextureView.html#isAvailable()
, so you should add it before mTextureView.getSurfaceTexture();
.
if(!mTextureView.isAvailable()){
return;// TODO Implement correct exception handling
}
910 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
617 Uncaught (inpromise) Error on Electron: An object could not be cloned
609 GDB gets version error when attempting to debug with the Presense SDK (IDE)
572 Who developed the "avformat-59.dll" that comes with FFmpeg?
© 2024 OneMinuteCode. All rights reserved.