Android Tutorial Custom class templates

Discussion in 'Libraries developers questions' started by Erel, Mar 12, 2018.

  1. Erel

    Erel Administrator Staff Member Licensed User

    Starting from B4A v8.0 it is possible to include custom class templates inside your libraries. Note that it will also be added to B4J and B4i.

    You can include multiple templates.

    There are two steps:
    1. Add the template files to the project. File extension must be .b4x_excluded.
    For example B4J jServer library now includes the three server handlers:


    2. Declare them with the new @CustomClasses annotation:
    @CustomClasses(values = {
           @CustomClass(name = 
    "Server Handler", fileNameWithoutExtension = "server_handler"),
           @CustomClass(name = 
    "Server Filter", fileNameWithoutExtension = "server_filter"),
           @CustomClass(name = 
    "Server WebSocket", fileNameWithoutExtension = "server_websocket")
    @DependsOn(values={"jetty_b4j", "c3p0-", "c3p0-oracle-thin-extras-"
           ,"mchange-commons-java-0.2.11", "json"})
    public class ServerWrapper {
    If you are using SLC to build the library then you should put the files in the 'additional' folder.

    The jar structure should be:


    Make sure to use BADoclet v1.07+. The updated doclet is available inside SLC.

    The generated XML should end with:
    <customClass>name:Server Handler, filenamewithoutextension:server_handler</customClass>
    Server Filter, filenamewithoutextension:server_filter</customClass>
    Server WebSocket, filenamewithoutextension:server_websocket</customClass>
    alwaysbusy and DonManfred like this.
  2. Star-Dust

    Star-Dust Expert Licensed User

    So it is possible to create it only in Java. It is not possible with the B4A libraries
  3. DonManfred

    DonManfred Expert Licensed User

    You can check the file "themes.jar" inside the internal Library folder.

    Rename it to and have a look at it.

    Just create a zip with just the templates in it (using the correct filenames (Extension)...
  4. Erel

    Erel Administrator Staff Member Licensed User

    Start a new thread in the questions forum and I'll explain how it can be done. As I wrote in the release thread it is quite simple.
  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