Android Example Creating a Library with Simple Library Compiler (SLC)

This is for people like me - B4A libraries for Dummies 101 (via SLC). I will attempt to explain it the best I can (there is nothing in this library that one can't do via B4A code. This is purely a learning exercise. There is NO specific theme to this library. It is just a bunch of different and mostly unrelated methods that was hacked together to test the principle).

I have set up a project as follows:

C:\Users\----------2\Documents\SecondLibrary
The SecondLibrary structure looks as follows:

SecondLibrary
libs
src
com
johan
Geometry
Geometry.java​
math
math.java​

Code of Geometry.java and math.java was created in NotePad (Windows). The following wrt the attached files:

JHSMATH.zip is the B4A project that I used to test the library that I have created from the above by making use of SLC (got code from various websites and adapted it to suite the library).
Screen Shot Second Library.png is how I have set up Simple Library Compiler to compile the library
src.zip contains the complete src folder as listed above.

Making use of SLC the jar and xml files will be created/generated in your additional library folder. It is called fiddleAround.jar and fiddleAround.xml. Geometry is a separate package and therefore the attached B4A project uses DIM's as follows.

Dim mymath As fiddleAround
Dim mymath1 As Geometry

Change the name of the packages in Geometry.java (package com.johan.Geometry and math.java (package com.johan.math to suite your needs (in order to follow your specific directory structure for SecondLibrary). If you change the name of the packages to something other than .....Geometry and ....math then you will need to change the names of the classes in Geometry.java and math.java to be the same.

The B4A project does nothing but print to the log. Don't expect and output on your screen. This is purely and exercise to try and understand how to create a library by making use of SLC.

The above is not a very good explanation - but I hope it could be of use for some newbies such as me. If it does not work - mail Erel :)! Only joking - will try and help best I can.

I have not included the library files (fiddleAround.jar and fiddleAround.xml) as you need to go through the exercise of making use of SLC to create them.

Edit: Replace folder in src.zip with folder in src(2).zip and recompile the library with SLC. It will then show proper help/examples for most of the methods/functions when the method/function is clicked on in the B4A dropdown box. Attached Help.png shows what I mean in case the above explanation is a bit wobbly. View/edit math.java and Geometry.java to see amendments in order to show/display the help tags (all in math.java amended, only 2 x methods done in Geometry.java - I leave the remainder of the help tags required for some methods in Geometry.java up to you)
 

Attachments

  • JHSMATH.zip
    7 KB · Views: 931
  • Screen Shot Second Library.png
    Screen Shot Second Library.png
    15.2 KB · Views: 1,302
  • src.zip
    3.8 KB · Views: 888
  • src (2).zip
    4.5 KB · Views: 853
  • Help.png
    Help.png
    79.8 KB · Views: 1,222
Last edited:
Hello Johan,

I´m learning how to wrapper library with your post. I saw that you just use notepad++ and SLC, apparently is a good way to wrapper libs.

I´m new in libraries. Do you think that this library is posible wrap this project ?


tks,

Leandro
 
Top