Question

i want to have barcode scanner on my android application.I try to follow intruction from this Using ZXing to create an android barcode scanning app and looking good because i've barcodeScanner app being installed on my phone that i wasnt realize before. when i try to another phone when i want to scan barcode it ask me to download barcodeScanner. my issue is like this thread Embed Zxing library without using Barcode Scanner app and follow instruction.but i got an error in this line super.onResume();.here is my error logcat

04-17 16:00:51.735: E/AndroidRuntime(6138): FATAL EXCEPTION: main
04-17 16:00:51.735: E/AndroidRuntime(6138): java.lang.RuntimeException: Unable to resume activity {ims.app.salesmarket/ims.app.salesmarket.EntryTO}: java.lang.NullPointerException
04-17 16:00:51.735: E/AndroidRuntime(6138):     at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2595)
04-17 16:00:51.735: E/AndroidRuntime(6138):     at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2623)
04-17 16:00:51.735: E/AndroidRuntime(6138):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2109)
04-17 16:00:51.735: E/AndroidRuntime(6138):     at android.app.ActivityThread.access$600(ActivityThread.java:134)
04-17 16:00:51.735: E/AndroidRuntime(6138):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1247)
04-17 16:00:51.735: E/AndroidRuntime(6138):     at android.os.Handler.dispatchMessage(Handler.java:99)
04-17 16:00:51.735: E/AndroidRuntime(6138):     at android.os.Looper.loop(Looper.java:154)
04-17 16:00:51.735: E/AndroidRuntime(6138):     at android.app.ActivityThread.main(ActivityThread.java:4624)
04-17 16:00:51.735: E/AndroidRuntime(6138):     at java.lang.reflect.Method.invokeNative(Native Method)
04-17 16:00:51.735: E/AndroidRuntime(6138):     at java.lang.reflect.Method.invoke(Method.java:511)
04-17 16:00:51.735: E/AndroidRuntime(6138):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:809)
04-17 16:00:51.735: E/AndroidRuntime(6138):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:576)
04-17 16:00:51.735: E/AndroidRuntime(6138):     at dalvik.system.NativeStart.main(Native Method)
04-17 16:00:51.735: E/AndroidRuntime(6138): Caused by: java.lang.NullPointerException
04-17 16:00:51.735: E/AndroidRuntime(6138):     at com.google.zxing.client.android.CaptureActivity.onResume(CaptureActivity.java:163)
04-17 16:00:51.735: E/AndroidRuntime(6138):     at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1159)
04-17 16:00:51.735: E/AndroidRuntime(6138):     at android.app.Activity.performResume(Activity.java:4553)
04-17 16:00:51.735: E/AndroidRuntime(6138):     at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2581)
04-17 16:00:51.735: E/AndroidRuntime(6138):     ... 12 more

how do i fix them? every help will be apriciated.thank you for your kindness.

Was it helpful?

Solution

I had faced the same problem. I tried to fix it by a couple of ways, and both of them eventually worked!!

  1. Go to onResume() at CaptureActivity.java. Comment the whole function except the line super.onResume(). Next, add the following lines into your activity:

@Override public void onResume(){ super.onResume(); }

  1. You could use the example from this link - http://khurramitdeveloper.blogspot.in/p/android-barcode-scan-using-zxing-library.html. It works for me without any hitch!
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top