Android Tutorial Shared Code Modules

Edit: shared modules are still supported however more powerful options are available in newer versions of B4X: https://www.b4x.com/android/forum/threads/86587

B4A v3.80 adds support for shared code modules.
Shared code modules are modules (Activity, Service, Class or Static Code) that are stored in a specific folder and can be shared by multiple projects, similar to the way that libraries are shared.

How it works

When a project is loaded the IDE looks for the modules files (bas files) in the project folder. If the module file doesn't exist then the IDE will look for the module in the configured shared modules folder.

The shared modules folder is set in the Paths Configuration dialog:

SS-2014-05-08_10.52.44.png


You can see that a module was loaded from the shared folder in the list of modules (the icon with the small arrow):

SS-2016-01-10_10.09.28.png


Adding a shared module to a project is done in the same way as adding a non-shared module.
You choose Project -> Add Existing Module. If the module folder is the shared folder then the module will be loaded as a shared module and will not be copied to the project folder.

If you want to convert a non-shared module to a shared module then you need to manually move the module file to the shared modules folder and reload the project
 
Last edited:

gawie007

Member
Licensed User
Longtime User
This is more like what I have been needing!
Brilliant work!
 

namnach

Member
Licensed User
Longtime User
This is very fine thinking - so "template" ( network, server, client .. ) can make for each Projects.
Thank you - !
;-)
 

GMan

Well-Known Member
Licensed User
Longtime User
Great Option :)
Is the same possible for .BALs ? :rolleyes:
 

klaus

Expert
Licensed User
Longtime User
Great Option :)
Is the same possible for .BALs ? :rolleyes:
Would be very useful !
Example:
I use a shared About module which has a dedicated bal file.
It would be very useful to share the bal file the same way as the module file.
 
Top