Can you tell me what I could have done wrong?
print code
Code:
Sub Class_Globals
Private bluetooth_functions As Toggle
Private bt_priter_functions As BT_Printer
Private type_print_window As Long
Dim qr As QRcode
Dim bm As Bitmap
End Sub
Public Sub Initialize(type_print As Long)
type_print_window = type_print
If bt_priter_functions.IsInitialized = False Then
bt_priter_functions.Initialize(Me,"bt_priter_functions",Encoding.UTF8)
Else
bt_priter_functions.Close
End If
Dim ImpPadrao As String
If File.Exists(File.DirDefaultExternal,"ConfImp.cfg") Then
ImpPadrao = File.GetText(File.DirDefaultExternal, "ConfImp.cfg") ' default printer mac
bt_priter_functions.Close
bt_priter_functions.SelectFromMac(ImpPadrao)
qr.Initialize
bm = qr.drawQRCode(Main.str_url_link)
End If
End Sub
Sub bt_priter_functions_ListPrinterAssociated (ListNameAndMac As List)
End Sub
Sub bt_priter_functions_DiscoveryNewPrinter (Print As NameAndMac)
End Sub
Sub bt_priter_functions_DiscoveryFinished
End Sub
Sub bt_priter_functions_DiscoveryNoDeviceFound
ToastMessageShow("Device not found",True)
End Sub
Sub bt_priter_functions_ConnectedToPrint
Dim is_qr_code As Boolean = False
bt_priter_functions.Connected
For Each mp_modalit As Map In Main.lst_print_infos
Dim r As Map = mp_modalit.Get("r")
Dim dados As String = r.Get("dados")
If dados.IndexOf(";") > 0 Then
Dim idx_carcter As Int = dados.IndexOf(";")+1
dados = dados.SubString2(idx_carcter,dados.Length)
is_qr_code = True
Else
is_qr_code = False
End If
If is_qr_code = True Then
bt_priter_functions.AddBuffer_Bitmap(bm,90)
bt_priter_functions.SendBufferToPrinter
bt_priter_functions.ClearBuffer
Sleep(6000)
Else
bt_priter_functions.AddBuffer_WriteLine(dados)
bt_priter_functions.SendBufferToPrinter
bt_priter_functions.ClearBuffer
Sleep(200)
End If
Next
bt_priter_functions.AddBuffer_WriteLine(mutil.Align_miniPrinters(mensagens.system_version & mensagens.update_version,mutil.ALING_CENTER))
bt_priter_functions.SendBufferToPrinter
bt_priter_functions.ClearBuffer
Sleep(150)
bt_priter_functions.AddBuffer_WriteLine(CRLF & CRLF & CRLF)
bt_priter_functions.SendBufferToPrinter
bt_priter_functions.ClearBuffer
Sleep(150)
bt_priter_functions.SendBufferToPrinter
bt_priter_functions.ClearBuffer
Sleep(150)
bt_priter_functions.Close
Select type_print_window
Case 1001
CallSub(visualiza_poule,"activy_finish_open_vendedor")
Case 1002
CallSub(web_view_open,"activy_finish_open_vendedor")
Case 1003
CallSub(poules_loterias,"activy_finish_open_vendedor")
End Select
End Sub
Sub bt_priter_functions_SendTerminated
ToastMessageShow("imprimindo",False)
End Sub
Error!
Code:
Unexpected event (missing RaiseSynchronousEvents): bt_priter_functions_sendterminated
Check the unfiltered logs for the full stack trace.
Error occurred on line: 90 (imprimir)
java.lang.IllegalArgumentException: Wrong number of arguments; expected 0, got 4
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runGoodChain(Shell.java:483)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:297)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:171)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resume(DebugResumableSub.java:43)
at anywheresoftware.b4a.keywords.Common$13.run(Common.java:1680)
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:6165)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:778)
print code
Code:
Sub Class_Globals
Private bluetooth_functions As Toggle
Private bt_priter_functions As BT_Printer
Private type_print_window As Long
Dim qr As QRcode
Dim bm As Bitmap
End Sub
Public Sub Initialize(type_print As Long)
type_print_window = type_print
If bt_priter_functions.IsInitialized = False Then
bt_priter_functions.Initialize(Me,"bt_priter_functions",Encoding.UTF8)
Else
bt_priter_functions.Close
End If
Dim ImpPadrao As String
If File.Exists(File.DirDefaultExternal,"ConfImp.cfg") Then
ImpPadrao = File.GetText(File.DirDefaultExternal, "ConfImp.cfg") ' default printer mac
bt_priter_functions.Close
bt_priter_functions.SelectFromMac(ImpPadrao)
qr.Initialize
bm = qr.drawQRCode(Main.str_url_link)
End If
End Sub
Sub bt_priter_functions_ListPrinterAssociated (ListNameAndMac As List)
End Sub
Sub bt_priter_functions_DiscoveryNewPrinter (Print As NameAndMac)
End Sub
Sub bt_priter_functions_DiscoveryFinished
End Sub
Sub bt_priter_functions_DiscoveryNoDeviceFound
ToastMessageShow("Device not found",True)
End Sub
Sub bt_priter_functions_ConnectedToPrint
Dim is_qr_code As Boolean = False
bt_priter_functions.Connected
For Each mp_modalit As Map In Main.lst_print_infos
Dim r As Map = mp_modalit.Get("r")
Dim dados As String = r.Get("dados")
If dados.IndexOf(";") > 0 Then
Dim idx_carcter As Int = dados.IndexOf(";")+1
dados = dados.SubString2(idx_carcter,dados.Length)
is_qr_code = True
Else
is_qr_code = False
End If
If is_qr_code = True Then
bt_priter_functions.AddBuffer_Bitmap(bm,90)
bt_priter_functions.SendBufferToPrinter
bt_priter_functions.ClearBuffer
Sleep(6000)
Else
bt_priter_functions.AddBuffer_WriteLine(dados)
bt_priter_functions.SendBufferToPrinter
bt_priter_functions.ClearBuffer
Sleep(200)
End If
Next
bt_priter_functions.AddBuffer_WriteLine(mutil.Align_miniPrinters(mensagens.system_version & mensagens.update_version,mutil.ALING_CENTER))
bt_priter_functions.SendBufferToPrinter
bt_priter_functions.ClearBuffer
Sleep(150)
bt_priter_functions.AddBuffer_WriteLine(CRLF & CRLF & CRLF)
bt_priter_functions.SendBufferToPrinter
bt_priter_functions.ClearBuffer
Sleep(150)
bt_priter_functions.SendBufferToPrinter
bt_priter_functions.ClearBuffer
Sleep(150)
bt_priter_functions.Close
Select type_print_window
Case 1001
CallSub(visualiza_poule,"activy_finish_open_vendedor")
Case 1002
CallSub(web_view_open,"activy_finish_open_vendedor")
Case 1003
CallSub(poules_loterias,"activy_finish_open_vendedor")
End Select
End Sub
Sub bt_priter_functions_SendTerminated
ToastMessageShow("imprimindo",False)
End Sub
Error!
Code:
Unexpected event (missing RaiseSynchronousEvents): bt_priter_functions_sendterminated
Check the unfiltered logs for the full stack trace.
Error occurred on line: 90 (imprimir)
java.lang.IllegalArgumentException: Wrong number of arguments; expected 0, got 4
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runGoodChain(Shell.java:483)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:297)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:171)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resume(DebugResumableSub.java:43)
at anywheresoftware.b4a.keywords.Common$13.run(Common.java:1680)
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:6165)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:778)