Android Question Java Object problem

JTmartins

Active Member
Licensed User
Longtime User
Understanding this Java Object thing is driving me nuts !!!

I have the following sub

B4X:
Sub test As JavaObject

Private jo As JavaObject

jo.InitializeStatic("android.hardware.usb.UsbManager")
Private mgr As JavaObject =jo.RunMethod("getAccessoryList",Null)
Return mgr
End Sub

I get : java.lang.IllegalArgumentException: expected receiver of type android.hardware.usb.UsbManager, but got java.lang.Class<android.hardware.usb.UsbManager> on the line Private mgr....


So I must be doing something really stupid, as most of my tests with Java Object are leading to similar results.

What am I referencing wrong ?

Thanks
 

JTmartins

Active Member
Licensed User
Longtime User
Thanks Erel,

I've been trying to understand the Java Object, as I need it to be able to use an external Jar. So I'm playing with it to learn.

I don't think the USB library will be enough for what I want to do.

I'have been studying Java, but I still haven't understand it's philosophy and learning how to interact between B4A and Jar's seems now of major importance to me.
 
Upvote 0

JTmartins

Active Member
Licensed User
Longtime User
I did not express myself correctly, Erel. The USB library is OK, as it allows me to get the device I want, but to comunicate with the card reader I need to use the external Jar wich basicly acts as a driver and has all the classes & methods to "talk" with the device...Or at least that is my understanding, which I hope is not wrong. :)
 
Upvote 0
Top