Java Question Using non-standard libraries

tchart

Well-Known Member
Licensed User
Longtime User
Currently evaluating the trial of B4A, very impressed so far.

Our software partner has an Android SDK in beta with 4 libraries (.JAR files).

Since these libraries are aimed at Eclipse and Java, can I use these with Basic4Android?

In other words if I have the JAR's how does B4A know what to do with them?

The documentation suggests I need the JAR file as well as another file. Where does this other file come from (or get generated)?

Thanks
 

timwil

Active Member
Licensed User
Longtime User
I am looking at the linked page and I still cannot seem to get it! (Maybe I am just really really tired and need to go to bed)

I have a .jar library that was delivered to me. I want to use it in B4A. From what I have read I need to do a simple wrapper. From the post it is still unclear to me as to exactly what has to be done.

Do I have to include the Core.jar/android.jar and b4ashared.jar in the eclipse project?

Do I just make a new class name with the required parameters of the original class then call the original class with the passed parameters?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Did you see the new video tutorial: http://www.b4x.com/forum/libraries-...1-video-tutorial-creating-simple-library.html

This will help you with creating the project. You will also need to include the other jar library. You have two options. Either unzip the jar file and add its files to your jar (it can be done from Eclipse automatically) or create a dummy XML file that will be responsible for adding the other jar. You can see an example in the AdMob library: AdMob Tutorial - Add ads to your application
 

timwil

Active Member
Licensed User
Longtime User
Thanks for the quick reply

I saw the video tutorial and have read and re-read the posts detailing how to do the libraries from scratch. I think I sort of get those.

What I don't understand is if I wanted to use an external library do i still have to include the B4AShared.jar the core.jar and the android.jar?

I am looking at the AdMob example and cannot see the similarity.

Note: I have NEVER used Java or Eclipse and I'm still trying to wrap my brain around the concepts
 

ashchopra

Member
Licensed User
Longtime User
Referencing and Using a 3rd Party Jar File

Hi,
This is exactly what I need to do too.
I have an Jar File (Also all the source code, as it is open source). I need to use its functions within B4Abdroid.

Now after seeing the video and reading the tutorials I understand the following:-

1. Start new eclipse project.
2. Add reference to Core.jar, B4Shared.jar, and the jar file that I need to use.
3. Now write code to refer each and every function, method, event etc of that jar file.
4. Use javadoc to create the .xml file for the jar file.
5. Put both these files in the library folder of B4Android.
6. Add reference to these two files in the B4Android project.

However, is there no simpler was to bypass writing all the code of step 3 above and refer the function/ methods/ events in the jar file directly. As long I have documentation indicating their syntax.(This is available as the jar source code is available)

Do help !!:BangHead:
 

ashchopra

Member
Licensed User
Longtime User
Opps Forgot to mention Android.jar too

Forgot to mention that Android.jar too needs to be referenced !!
:signOops:
 

timwil

Active Member
Licensed User
Longtime User
I tried but just could not get my head wrapped around working with the external .jar so I got XverhelstX to make up the library for me. Look him up - he is very fast and it did not cost me much either! :)
 
Top