Comments (12)
Let me look into it and update it here.
from qreader.
@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.
Yes. I was using the exact sample app that gets this error.
from qreader.
@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.
@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.
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.
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.
from qreader.
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.
@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.
@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.
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)
- java.lang.IllegalStateException: Camera already started! HOT 3
- Flash feature HOT 2
- Camera is stretched HOT 8
- Start activity in onDetected() and then pressing back HOT 2
- Surface View stops camera preview HOT 1
- Need Design Logo/Icon/Favicon HOT 1
- OpenGLRenderer: endAllStagingAnimators on 0x55a2950170 (RippleDrawable) with handle 0x55a2661e30 HOT 1
- Barcode recognition libs are not downloaded and are not operational HOT 7
- How can I read QR code once and stop QrReader HOT 7
- Question HOT 1
- setBackgroundDrawable with shape
- milestone for next release HOT 2
- Migrate to Maven Central HOT 1
- Move codebase to Kotlin
- Move all the docs into its own markdown file inside the repo.
- Cleanup readme
- Add tests
- 📖 Guest Book 🙇🏻♂️
- Unable to see preview HOT 5
- Failed resolution of: Lcom/google/android/gms/internal/zzbck;
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qreader.