Android Question Use java libs with javaobject

stevel05

Expert
Licensed User
Longtime User
If it only does what is shown in the video, it would be easier to create a class / custom view in B4a to do the same.
 
Upvote 0

sareban

Member
Thanks
But I want to learn how I can use java libraries with javaobject in B4A
 
Upvote 0

Jorge M A

Well-Known Member
Licensed User
Longtime User
Usefull tutorials from @DonManfred :
 
Upvote 0

Jorge M A

Well-Known Member
Licensed User
Longtime User
Upvote 0

sareban

Member
That library hasnt jar file
Should the java file be converted to jar file with wrapp?
is it possible to convert java file to jar file without wrapp?
 
Upvote 0

TILogistic

Expert
Licensed User
Longtime User

+}
 
Upvote 0

Biswajit

Active Member
Licensed User
Longtime User
That library hasnt jar file
Should the java file be converted to jar file with wrapp?
is it possible to convert java file to jar file without wrapp?
Yes in most cases its possible to use jar file without wrapper.

1. Copy that jar and its dependencies (if applicable) to additional library folder.
2. Include those using #AdditionalJar
B4X:
#AdditionalJar: yourlib.jar
3. Add #if JAVA at the bottom of the activity in which you want to use that library functions.
4. Inside that #if import relevant class from that library
5. Then write a function to use that library functions as you want.
B4X:
#if JAVA
import your.library.classname;

Public void testfunction(){
   YourLibClass var1 = new YourLibClass(); //just an example
}
#End if
6. Call that function from B4A code using JavaObject.
B4X:
Dim jo as JavaObject=Me
jo.RunMethod("testfunction",null)
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…