Android Tutorial [B4X] Projects Templates

This is a new feature. It is included in B4J v8.50 and B4i v6.80 (betas) and will be included in the next versions of B4A and B4R.

1594122248131.png


This is a very simple and useful feature. When you create a new project, the project is created based on the chosen template.
It is especially important for cross platform projects where a new project actually creates three platform specific projects, with the recommended structure and shared code.

The templates are simple zip files, with the b4xtemplate extension. The template files should be located in the internal or additional libraries folders.
Files with $APPNAME$ in their name will be replaced with the project name.

Refreshing the list of libraries will also refresh the list of templates.

Two templates files are attached as examples. These are internal templates and are preinstalled with the IDE.
 

Attachments

  • B4XPages.b4xtemplate
    9.6 KB · Views: 1,271
  • B4XTurtle.b4xtemplate
    3.3 KB · Views: 1,180

LucaMs

Expert
Licensed User
Longtime User
The template files should be located in the internal or additional libraries folders.
It seems not to work if you place the file in the additional libraries folders.

Note that there, additional libraries folders, I have:
1600256456053.png

and tried to place the file here, out of any of those folders (and only now I'm thinking that maybe I should put the template file in the B4X folder, but if it were so it would mean that that structure would be mandatory, not just recommended).

Placing the file in the internal libraries folder, it works (is shown in the IDE).


P.S. I should put the template file in the B4X folder.
 
Top