App crashed suddenly when I launch scan (FRAGMENT)

209 views
Skip to first unread message

Mayeul

unread,
Feb 21, 2017, 9:13:29 PM2/21/17
to zxing
Hello every body,

So I'm using zxing scanner in an android project, I'm using it inside a fragment, and I have a probleme. When I launch my scan, I have two possibilites.

First one :

-> The app crash without explication. And it's weird because it seems that the scan settled well, cos I got this on my Log Cat.

```java
I/com.google.zxing.client.android.camera.open.OpenCameraInterface: Opening camera #0
E/Camera: Camera new cameraInitNormal:0
I/CameraConfiguration: Screen resolution: Point(1794, 1080)
I/CameraConfiguration: Supported preview sizes: 1920x1080 1440x1080 1280x960 1280x720 960x720 960x544 720x720 640x480 352x288 320x240 208x144 176x144
I/CameraConfiguration: Using largest suitable preview size: Point(1920, 1080)
I/CameraConfiguration: Camera resolution: Point(1920, 1080)
```
but the app crash, it's showing the scan windows during few seconds, then the app is closing.
----------

Second one :

-> If I put a "wait" after integrator.initiateScan(), the app terminate (on the logcat of android studio) and it doesn't display that the camera settled well, but the scan show up and stay active on the app and can recognize bare code, if it detect a code bare, the app is closing :oo .

```java
IntentIntegrator integrator = new IntentIntegrator(getActivity());
integrator.setResultDisplayDuration(0); // milliseconds to display result on screen after scan
integrator.setCameraId(0);
integrator.setPrompt("Lel");
integrator.initiateScan();
try {
integrator.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
```java

Any ideas ? I think put an integrator.wait() isn't a good idea. Well we shouldn't use it no ? If you have any ideas, or links which could eventually help me... :) If you need more informations, just tell me ! Thank's for ur help !

Reply all
Reply to author
Forward
0 new messages