I noticed I get a "startPreview failed" on calling CaptureActivity
from my app every now and then. I don't have any particular pattern to
reproduce it. The crash happens on several models (Thunderbolt 4G,
Samsung Facinate, Galaxy S, DroidX, etc...).
0 java.lang.RuntimeException: Unable to resume activity
{com.mydomain.myapp/com.google.zxing.client.android.CaptureActivity}:
java.lang.RuntimeException: startPreview failed
1 at
android.app.ActivityThread.performResumeActivity(ActivityThread.java:
2485)
2 at
android.app.ActivityThread.handleResumeActivity(ActivityThread.java:
2506)
3 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:
1064)
4 at android.os.Handler.dispatchMessage(Handler.java:99)
5 at android.os.Looper.loop(Looper.java:150)
6 at android.app.ActivityThread.main(ActivityThread.java:4293)
7 at java.lang.reflect.Method.invokeNative(Native Method)
8 at java.lang.reflect.Method.invoke(Method.java:507)
9 at com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:839)
10 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
11 at dalvik.system.NativeStart.main(Native Method)
12 Caused by: java.lang.RuntimeException: startPreview failed
13 at android.hardware.Camera.startPreview(Native Method)
14 at
com.google.zxing.client.android.camera.CameraManager.startPreview(CameraManager.java:
192)
15 at
com.google.zxing.client.android.CaptureActivityHandler.<init>(CaptureActivityHandler.java:
66)
16 at
com.google.zxing.client.android.CaptureActivity.initCamera(CaptureActivity.java:
934)
17 at
com.google.zxing.client.android.CaptureActivity.onResume(CaptureActivity.java:
370)
18 at
android.app.Instrumentation.callActivityOnResume(Instrumentation.java:
1242)
19 at android.app.Activity.performResume(Activity.java:4004)
20 at
android.app.ActivityThread.performResumeActivity(ActivityThread.java:
2475)
21 ... 10 more
22 java.lang.RuntimeException: startPreview failed
23 at android.hardware.Camera.startPreview(Native Method)
24 at
com.google.zxing.client.android.camera.CameraManager.startPreview(CameraManager.java:
192)
25 at
com.google.zxing.client.android.CaptureActivityHandler.<init>(CaptureActivityHandler.java:
66)
26 at
com.google.zxing.client.android.CaptureActivity.initCamera(CaptureActivity.java:
934)
27 at
com.google.zxing.client.android.CaptureActivity.onResume(CaptureActivity.java:
370)
28 at
android.app.Instrumentation.callActivityOnResume(Instrumentation.java:
1242)
29 at android.app.Activity.performResume(Activity.java:4004)
30 at
android.app.ActivityThread.performResumeActivity(ActivityThread.java:
2475)
31 at
android.app.ActivityThread.handleResumeActivity(ActivityThread.java:
2506)
32 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:
1064)
33 at android.os.Handler.dispatchMessage(Handler.java:99)
34 at android.os.Looper.loop(Looper.java:150)
35 at android.app.ActivityThread.main(ActivityThread.java:4293)
36 at java.lang.reflect.Method.invokeNative(Native Method)
37 at java.lang.reflect.Method.invoke(Method.java:507)
38 at com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:839)
39 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
40 at dalvik.system.NativeStart.main(Native Method)
Any idea?
I am actually using the Android part of ZXing as an Android library
project.
Is that something you "frown on"?
What's the proper way of integrating zxing with another Android app? I
have seen lots of Android apps having a built-in barcode scanner. I
guess quite a few of them use the zxing lib without relying on intents
to launch the barcode scanner as a separate app, thus giving users a
better experience.
On Dec 6, 11:35 am, Sean Owen <sro...@gmail.com> wrote:
But I guess my interpretation, with all due respect, is this is a
personal appeal/preference. With Apache license, to my best
understanding, I don't think I am legally bound to use the project in
a specific way, ie. as library or not.
May I ask why you don't want the project to be used as a library
although this is the best open source and the de facto standard
barcode scanner project out there?
There are another group of developers who do need the barcode scanning
capability as as intrinsic feature in their app. The intention is
never to create another general purpose barcode scanner but use it to
fulfill their business need. To create an optimal user experience,
they have to make the scanning function part of their app with proper
customizations and UI improvements. I think zxing project is a foundry
project enabling people doing that. Also, to my best understanding and
consciousness, in this context, integrating zxing as a library is a
legal, legitimate, ethical, and moral conduct. I hope you wouldn't
find disagreement with me on this belief.