Java Question i create new lib via b4a but not work in other b4a

hello

i use Project/CompileToLib (Alt+5);

create new test1.java(lib) via file1 b4a

and copy this file to library folder

create new project

and refresh libs

but cannot find my create lib

have sample or film or tutorial to learn create library in B4a

in library project i create new module
in module create this sub

lib:
Sub SumEr(a As Int,b As Int) As Int
    
    Return a+b   
End Sub

thanks
Ghaneipour
 

klaus

Expert
Licensed User
Longtime User
It would be easier for us to help you if you posted the B4A project from where you created the library.
Without knowing what exactly you have done it is impossible to give a concrete advice.
You may also consider creating a b4xlib instead of a B4A lib.
 
hello

I want add some functions in my library and then i send it to other user that then use it.

same as sum function.
they send 2 number and i add 2 number together and i answer user added number.

real use:

I have an algorithm for create card MIFARE (RFID) security key.

user send to lib UID and CustomerID and DVid then Lib process and create Key and user can open card.

** RFID MIFARE card use for money transfer ( Taxy - Metro - Train ... as ticketing AFC )
*** Security is important and algorithem only some people know this . but more user can create application for himself

now:
i want try test lib
i make lib via ALT+5 but in second project after add to project in list, i cannot use it ((( DIM S AS TEST2 or DIM S AS SUMER )) but can not use this
 
Last edited:
1733817489397.png
 
thanks i found my answer

1- i must set sub as public in lib file
2- add lib ( .java + .xml ) to lib folder
3- add lib in new project
4- call sub only

in new project =>

Private Sub Button1_Click
Log( sum.SumEr(5,9))
End Sub



in lib =>

Sub SumEr(a As Int,b As Int) As Int

Return a+b
End Sub


not need any setting and import
All handle by b4x
 

Attachments

  • usemylib.rar
    4 KB · Views: 6
  • myLib2.rar
    66.2 KB · Views: 6
  • test2.rar
    1.2 KB · Views: 6
Top