Android Tutorial [B4X] Sharing modules and classes

Discussion in 'Tutorials & Examples' started by Erel, Dec 20, 2017.

  1. Erel

    Erel Administrator Staff Member Licensed User

    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: https://www.b4x.com/android/forum/threads/b4x-modules-files-groups-and-folders.86587

    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: Jul 18, 2018
    int21h, toby, inakigarm and 3 others like this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice