Android Tutorial [B4X] Sharing modules and classes

In newer versions of B4A, B4J and B4i it is simple to share code modules between projects, including projects targeting other platforms.

More information here:

In B4J and B4i there are 2 types of modules:

Code modules (also named static code module) and class modules.
Code modules are more or less the same as class modules with exactly one instance (singletons).

In B4A there are 4 types of modules:
Activities, services, static code modules and classes.

Activities and services are mapped to native components and each has a special type of context.
Activities and services are also similar to singleton classes.
Static code modules in B4A do not have a context of their own and therefore cannot handle events. In most cases you should prefer classes over static code modules

What happens when you reference an Activity or Service module from B4J or B4i?

The module will be treated as a static code module which is the closest component. The B4A type will be kept internally so the module will remain an activity or service in B4A.
Last edited: