Android Question .jar third-party ... this stranger!

Antonio D'Angeli

Licensed User
my dears (sorry for my english but google's translator's fault)
it is by many that I develop in various languages but above all in .net
lately I am using b4a (quite complex management systems have been running for some time with my clients) and I am extremely happy for the convenience of development and the enormous contribution from Erel (but also from the whole community). but I always find it difficult (obviously I have not understood the logic well) to use third-party .jar. I have done more tests and seen examples but I can't solve problems that seem to me quite simple.
Last example: on a Datalogic scanner I have to interrupt the scanner button under certain conditions.
Datalogic provides me with datalogic.jar for Eclipse with these specifications:
api: com.datalogic.device.input
class: KeyboardManager
method: disableKey (VScanEntry scanCode, boolean disable).
my code:
Sub GetContext As JavaObject
    Dim pp As JavaObject
    Dim a As Int = 314
    Return pp.InitializeNewInstance("com.datalogic.device.input.VScanEntry",Array(a))
End Sub

Sub GetPicasso As JavaObject
    Dim pp As JavaObject
    Return pp.InitializeNewInstance("com.datalogic.device.input.KeyboardManager",Null)
End Sub

Sub Button1_Click
    Log(GetPicasso.RunMethod("disableKey",  Array(GetContext,True)))
I have no error but it does not work......
Thanks for your help


Staff member
Licensed User
Don't create a new instance each time. Delete these two subs.

Start with:
Dim KeyboardManager As JavaObject
Dim VScan As JavaObject
 Dim a As Int = 314
KeyboardManager.RunMethod("disableKey",  Array(VScan, True))