When i click on the reader button opened up asking permission for camera, allowed after that when i click on close button or click on back button app itself quit. force quit.
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Thread$State
java.lang.Thread.getState()' on a null object reference
at
com.notbytes.barcode_reader.camera.CameraSource$FrameProcessingRunnable.release(CameraSource.java:1101)
at com.notbytes.barcode_reader.camera.CameraSource.release(CameraSource.java:327)
at com.notbytes.barcode_reader.camera.CameraSourcePreview.release(CameraSourcePreview.java:70)
at com.notbytes.barcode_reader.BarcodeReaderFragment.onDestroy(BarcodeReaderFragment.java:367)
at androidx.fragment.app.Fragment.performDestroy(Fragment.java:2927)
at androidx.fragment.app.FragmentStateManager.destroy(FragmentStateManager.java:482)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1294)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1354)
at androidx.fragment.app.FragmentManager.moveFragmentToExpectedState(FragmentManager.java:1432)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1495)
at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:2617)
at androidx.fragment.app.FragmentManager.dispatchDestroy(FragmentManager.java:2601)
at androidx.fragment.app.Fragment.performDestroy(Fragment.java:2922)
at androidx.fragment.app.FragmentStateManager.destroy(FragmentStateManager.java:482)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1294)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1354)
at androidx.fragment.app.FragmentManager.moveFragmentToExpectedState(FragmentManager.java:1432)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1495)
at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:2617)
at androidx.fragment.app.FragmentManager.dispatchDestroy(FragmentManager.java:2601)
at androidx.fragment.app.FragmentController.dispatchDestroy(FragmentController.java:330)
at androidx.fragment.app.FragmentActivity.onDestroy(FragmentActivity.java:365)
at androidx.appcompat.app.AppCompatActivity.onDestroy(AppCompatActivity.java:242)
at android.app.Activity.performDestroy(Activity.java:8225)
at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1342)
at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:5441)
at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:5493)?
at android.app.servertransaction.DestroyActivityItem.execute(DestroyActivityItem.java:44)?
Camera source
Releases the underlying receiver. This is only safe to do after the associated thread
has completed, which is managed in camera source's release method above.
@SuppressLint("Assert")
void release() {
assert (mProcessingThread.getState() == State.TERMINATED);
mDetector.release();
mDetector = null;
}
Camera source
Stops the camera and releases the resources of the camera and underlying detector.
public void release() {
synchronized (mCameraLock) {
stop();
mFrameProcessor.release();
}
}
camera source preview
public void release() {
if (mCameraSource != null) {
mCameraSource.release();
mCameraSource = null;
}
}
Barcode reader fragment
Releases the resources associated with the camera source, the associated detectors, and the
rest of the processing pipeline.
@Override
public void onDestroy() {
super.onDestroy();
if (mPreview != null) {
mPreview.release();
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…