Open Dima-369 opened 6 years ago
@Gira-X : Could you try use ViewStub as placeholder for QRCodeReaderView, then only inflate when permission granted?
Yes, that works indeed!
Here is the modified sample repo which uses a ViewStub
: https://github.com/Gira-X/QRCodeReaderView
But in the end we decided to use a Google Vision API view because it scans a bit faster: https://github.com/wax911/Vision-Barcode-Scanner
The sample app avoids this by only inflating the layout when the camera permission is given.
We are migrating this library into our project and this would allow us to quickly port everything without rewriting all the view logic.
You can emulate this quickly by moving the line below from
initQRCodeReaderView()
toonCreate()
while keeping the content variable as a class member variable:The sample app will then crash (after quickly displaying a single camera frame) with: