Original post: [B4X] [B4XPages] Barcode Reader
I'm using the example, I just changed the code type to PDF417. This information is printed on identity documents.
This example reads it and works
This not
I'm using the example, I just changed the code type to PDF417. This information is printed on identity documents.
The only change in the entire code:
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
toast.Initialize(Root)
StopCamera
B4XPages.SetTitle(Me, "Barcode Example")
#if B4A
CreateDetector (Array("PDF417"))
#Else if B4i
scanner.Initialize2("scanner", pnlPreview, Array(scanner.TYPE_93, scanner.TYPE_128, scanner.TYPE_QR))
Wait For Scanner_Ready (Success As Boolean)
If Success = False Then
btnStartStop.Enabled = False
toast.Show("Failed to initialize the scanner.")
End If
#end if
End Sub
This example reads it and works
This not
Logger connected to: motorola motorola edge 30 pro
--------- beginning of main
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create (first time) **
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
** Activity (main) Resume **
findCamera
null
2
facing: 0, 0
findCamera
0
2
facing: 0, 0
Preview Orientation: 90
Error occurred on line: 141 (B4XMainPage)
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:132)
at b4a.example.b4xmainpage._camera1_preview(b4xmainpage.java:398)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:1114)
at anywheresoftware.b4a.keywords.Common.CallSubNew2(Common.java:1069)
at b4a.example.cameraexclass._camera_preview(cameraexclass.java:354)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:201)
at anywheresoftware.b4a.objects.CameraW$2$1$1.onPreviewFrame(CameraW.java:147)
at android.hardware.Camera$EventHandler.handleMessage(Camera.java:1193)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loopOnce(Looper.java:238)
at android.os.Looper.loop(Looper.java:357)
at android.app.ActivityThread.main(ActivityThread.java:8118)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:957)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.hashCode()' on a null object reference
at com.google.android.gms.vision.barcode.BarcodeDetector.detect(com.google.android.gmslay-services-vision@@20.1.3:27)
... 28 more
Last edited: