Hi ,
I try to use javaobjet to call an external library for usb printer, (dont suggest me "felusb" it doesn't work for me or better worked for three years and now crash),
the library I whould like to use ia named "printer.jar"
in pure JAVA I use the following code
using b4a I try with adding printer.jar to externallib
I don't know how I may pass the callback handler params because in the example I found the callback object use the javaobjet already initialized.
Any suggestion?
I try to use javaobjet to call an external library for usb printer, (dont suggest me "felusb" it doesn't work for me or better worked for three years and now crash),
the library I whould like to use ia named "printer.jar"
in pure JAVA I use the following code
java example:
import com.printer.posbank.Printer;
public class MainActivity extends Activity {
…
private Printer mPrinter;
…
public void onCreate(Bundle savedInstanceState) {
…
mPrinter = new Printer(this, mHandler, null);
…
}
private final Handler mHandler = new Handler(new Handler.Callback() {
public Boolean handleMessage(Message msg) {
…
}
}
}
using b4a I try with adding printer.jar to externallib
b4a code:
#Region Project Attributes
...
#AdditionalJar: printer
#End Region
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout")
Dim jo As JavaObject
Return jo.InitializeNewInstance("com.printer.posbank.Printer",Array As Object(GetContext,????,null))
.....
End Sub
I don't know how I may pass the callback handler params because in the example I found the callback object use the javaobjet already initialized.
getpicasso tutorial:
'third example: download image with callback
Dim jo As JavaObject = GetPicasso
Dim callback As Object = jo.CreateEvent("com.squareup.picasso.Callback", "Callback", Null)
GetPicasso.RunMethodJO("load", Array(url)).RunMethodJO("into", Array(img1, callback))
Any suggestion?