Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.IllegalStateException: Camera already started! #56

Open
lakshyapunhani opened this issue Apr 24, 2018 · 3 comments
Open

java.lang.IllegalStateException: Camera already started! #56

lakshyapunhani opened this issue Apr 24, 2018 · 3 comments
Assignees
Labels

Comments

@lakshyapunhani
Copy link

lakshyapunhani commented Apr 24, 2018

E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.shanky.qrscanner, PID: 8249
java.lang.IllegalStateException: Camera already started!
at github.nisrulz.qreader.QREader.startCameraView(QREader.java:213)
at github.nisrulz.qreader.QREader.start(QREader.java:176)
at github.nisrulz.qreader.QREader$2.onGlobalLayout(QREader.java:118)
at android.view.ViewTreeObserver.dispatchOnGlobalLayout(ViewTreeObserver.java:981)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2414)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1522)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7098)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:927)
at android.view.Choreographer.doCallbacks(Choreographer.java:702)
at android.view.Choreographer.doFrame(Choreographer.java:638)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:913)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6682)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)

This happens when application goes in paused state while scanning qr code and just resume the application it will crash

This is the code for paused state and resume state

@OverRide
protected void onPause() {
super.onPause();

    if (hasCameraPermission) {

        // Cleanup in onPause()
        // --------------------
        qrEader.releaseAndCleanup();
    }
}

@Override
protected void onResume() {
    super.onResume();

    if (hasCameraPermission) {

        // Init and Start with SurfaceView
        // -------------------------------
        qrEader.initAndStart(mySurfaceView);

    }
}
@nisrulz nisrulz self-assigned this Apr 24, 2018
@nisrulz nisrulz added the bug label Apr 24, 2018
@riyal123
Copy link

riyal123 commented Aug 6, 2019

any update on this?

@khaled-qasem
Copy link

@nisrulz Any updates?

@nisrulz
Copy link
Owner

nisrulz commented Mar 31, 2020

@khaled-qasem

Please read my comment here: #68 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants