Usually I will try to Log the object to see it is successfully initialized.
Try
Dim jo As JavaObject
jo.InitializeNewInstance("com.pos.device.printer.PrintTask", Null)
Log(jo)
Catch
Log(LastException)
End Try
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create (first time) **
printing
Error occurred on line: 582 (Main)
java.lang.RuntimeException
at com.pos.device.printer.PrintTask.<init>(PrintTask.java:20)
at java.lang.Class.newInstance(Native Method)
at anywheresoftware.b4j.object.JavaObject.InitializeNewInstance(JavaObject.java:86)
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:348)
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.raiseEvent2(BA.java:205)
at anywheresoftware.b4a.debug.Debug.delegate(Debug.java:262)
at za.co.irays.sfpayments.main._print(main.java:506)
at za.co.irays.sfpayments.main._activity_create(main.java:498)
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 za.co.irays.sfpayments.main.afterFirstLayout(main.java:131)
at za.co.irays.sfpayments.main.access$000(main.java:43)
at za.co.irays.sfpayments.main$WaitForLayout.run(main.java:109)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6121)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1059)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:949)
** Activity (main) Resume **