Git Product home page Git Product logo

Comments (12)

nisrulz avatar nisrulz commented on September 25, 2024 2

Let me look into it and update it here.

from qreader.

nisrulz avatar nisrulz commented on September 25, 2024

@TonyTangAndroid are you setting the surface view as explained in the readme ? Also check if the sample app also throws the same error ?

from qreader.

TonyTangAndroid avatar TonyTangAndroid commented on September 25, 2024

Yes. I was using the exact sample app that gets this error.

from qreader.

joelclaudio avatar joelclaudio commented on September 25, 2024

@nisrulz +1 I am having the same issue. It occurs when I read a QRCode with a video a url, launch the intent to play the video and come back to the fragment that has the qrreader. Using Lollipop on Moto G 1st gen.

I call qrReader.stop before calling the intent, but that doesn't seem to be the problem. I'll come back with more details after some tests. Thanks.

[EDIT] Just executed some more tests, this seem to be happening when I am opening a new activity to play a video url:

Uri uri = Uri.parse(url); Intent i = new Intent(Intent.ACTION_VIEW, uri); startActivity(i);

from qreader.

leongwaikay avatar leongwaikay commented on September 25, 2024

@nisrulz I might be having the same issue. The surface view turns black and doesn't update whenever the activity resumes. This happens with the sample app as well.

To replicate, simply leave the app by going to home, then resume the app.

from qreader.

malti4 avatar malti4 commented on September 25, 2024

Hello sir ,i have the same issue as of Mr Joelclaudio.And i really need the solution.Please help.When i open the mail client by intent than on coming back to activity i m not able to scan and surface view shows black screen.Please help as soon as possible

from qreader.

leongwaikay avatar leongwaikay commented on September 25, 2024

Ok I managed to find the problem and fix it.

When QReader.initAndStart() is called in onResume(), it adds a GlobalLayoutListener on surfaceView which calls QReader.start(). In here, it checks the boolean surfaceCreated and if it is false, it adds surfaceHolderCallback to the holder.

Now the issue is that surfaceHolderCallback removes itself from surfaceView when it is destroyed. It might be a change in the latest Android but when the view is rebuilt, the same surfaceView is used and re-created. The problem is that the re-adding of surfaceHolderCallback occurs after the surfaceView has been created, thus the surfaceCreated listener event is never called, resulting in the camera not starting.

The way to fix this is to not remove the callback when surfaceView is destroyed. This can be done by removing line 106 of QReader.java: surfaceHolder.removeCallback(this);

from qreader.

malti4 avatar malti4 commented on September 25, 2024

from qreader.

leongwaikay avatar leongwaikay commented on September 25, 2024

It is read only because you are currently "linking" to the package in GitHub. What you need to do is clone the source out and then add it as a module to your project. Then you can edit the source.

from qreader.

nisrulz avatar nisrulz commented on September 25, 2024

@pottiepie if you think that you have fixed the issue, could you send a PR. I haven't been able to pick the library code for sometime because of work.

from qreader.

malti4 avatar malti4 commented on September 25, 2024

@pottiepie i did as per your instructions bt it gives me error on resuming that "Fail to connect to camera service".So help me in that

from qreader.

nisrulz avatar nisrulz commented on September 25, 2024

Closing as issue is outdated. Please open a new issue if the issue still persists.

The library will be undergoing some maintenance soon.

from qreader.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.