Android Question Using external jar lib

menneaduplo

Member
Licensed User
Longtime User
Hello all,

I need help using a third-party library with B4a.

They provided me a minimal library to certify if I could use it with B4a.
The sample library should return the uppercase of a string

I declared it in the project with...
B4X:
#AdditionalJar: string_converter

then I called up the library as follows...

B4X:
   Dim Ret As JavaObject
   Dim Parameters As String = "Test"
   Ret=Ret.InitializeStatic("com.logamic.converter.StringConverter").RunMethodJO("convertToUpperCase",Array(Parameters))

When I run the program the following error appears:
"java.lang.IllegalArgumentException: expected receiver of type com.logamic.converter.StringConverter, but got java.lang.Class <com.logamic.converter.StringConverter>"

I attach the sample library.

Thanks in advance.
Mennea
 

Attachments

  • string_converter.jar
    835 bytes · Views: 383

DonManfred

Expert
Licensed User
Longtime User
the class is not an static class

B4X:
    Dim Ret As JavaObject
    Dim Parameters As String = "Test"
    Log(Ret.InitializeNewInstance("com.logamic.converter.StringConverter",Null).RunMethodJO("convertToUpperCase",Array(Parameters)))
 
Last edited:
Upvote 0
Top