I developed a software using an external bluetooth printer.It works fine. But I received a device with built-in printer. The vendor sent me the SDK and library and Eclipse example.
The library ,named j1009.jar has a folder with 2 files (.so files)
I copied the library and the folder inside VB4A libraries folder.
Extracted from the eclipse test program sended by provider I attach the library class structure
I tried to use the library in several ways using JavaObject but allways received an error message
I show the last attempt I wrote, but it is not the only one I tried
Here like the code in the JavaObject thread page
This is my last code :
When click on button3, the error message is :
Vendor's documentation for Printer class incluye ….. Printer.PrintString(string)
Any help or technical orientation would be appreciated. If you need more information I will suply.
If not possible to use JavaObject I think I have two choices :
1.- Built a VB4A library from the j1009.jar library
2.- "capture" my vb4a project from Eclipse and add the library functions . But I think this is not possible.
Please , Could you send me links with related help for the easiest way you think is the best of both choices? ,well in case you think it is not possible to use JavaObject
Thanks in advance for your time and beg your pardon for my English or if the question is silly (I am not java developer).
The library ,named j1009.jar has a folder with 2 files (.so files)
I copied the library and the folder inside VB4A libraries folder.
Extracted from the eclipse test program sended by provider I attach the library class structure
I tried to use the library in several ways using JavaObject but allways received an error message
I show the last attempt I wrote, but it is not the only one I tried
Here like the code in the JavaObject thread page
B4X:
#AdditionalJar:j1009
Sub GetContext As JavaObject
Return GetBA.GetField("context")
End Sub
Sub GetBA As JavaObject
Dim jo As JavaObject
Dim cls As String = Me
cls = cls.SubString("class ".Length)
jo.InitializeStatic(cls)
Return jo.GetFieldJO("processBA")
End Sub
This is my last code :
B4X:
Sub printe AsJavaObject
Dim jo AsJavaObject
Return jo.InitializeStatic("com.bw.spdev.Printer")
End Sub
B4X:
Sub Button3_Click
Return printe.RunMethodJO("PrintString",Array("ggggg"))
End Sub
When click on button3, the error message is :
B4X:
An error in sub:java.lang
illegalArgumentException:
expected received of type com.bw.spdev.printer ,but got java.lang.Class<com.bw.spdev.Printer>
Vendor's documentation for Printer class incluye ….. Printer.PrintString(string)
Any help or technical orientation would be appreciated. If you need more information I will suply.
If not possible to use JavaObject I think I have two choices :
1.- Built a VB4A library from the j1009.jar library
2.- "capture" my vb4a project from Eclipse and add the library functions . But I think this is not possible.
Please , Could you send me links with related help for the easiest way you think is the best of both choices? ,well in case you think it is not possible to use JavaObject
Thanks in advance for your time and beg your pardon for my English or if the question is silly (I am not java developer).