Android Tutorial [B4X] Documentation Booklets

The B4X documentation booklets are available in PDF format, Download Link.
All files are included in the zip file in the link above, pdf booklets and all the source code.

You can also download all the source code for al booklets, SourceCode.

These booklets cover the four B4X platforms.
Some don't cover B4R because the subject is not relevant for B4R like Visual Designer.

Example projects with source code are included.

All booklets can be accessed online with the links below.
The generic link is: https://www.b4x.com/guides/BookletName/?page=xx
In this example we reach the B4xCustomViews booklet page 59: https://www.b4x.com/guides/B4xCustomViews/?page=59
The booklet names must begin with B4x (the x is in lower case) and without blank characters.
The summary of the list can be found here: Documentation
To get the source code of the example projects you can either download the entire zip file with the pdf booklets or only the source codes with the SourceCode link on top or at the end in the list below.

General booklets:
B4X Getting started
This booklet explains how to start with each B4x product (B4A, B4i, B4J and B4R).
B4X Language
This booklet explains the language for B4A, B4i, B4J and B4R.
B4X IDE
This booklet explains the Integrated Developpment Environment for B4A, B4i, B4J and B4R.
B4X Visual Designer
This booklet explains the Visual Designer for B4a, B4i and B4J.
B4X Help tools
This booklet explains some help tools for B4X. In the previous editions, its content was a chapter in the four booklets above.

Specific booklets:
B4XPages Cross-platform projects
This booklet explains how to make cross-platform projects.
B4X Custom Views + CustomViews_SourceCode, specific code for this booklet.
This booklet explains the CustomView subject for B4A, B4i and B4J.
B4X Graphics
This booklet explains Graphics for B4A, B4i, B4J, XUI And BitmapCreator.
B4X XUI
This booklet explains the XUI library which makes it easier to share code between B4A, B4J and B4i projects.
B4X SQLiteDatabase
This booklet explains the use of the SQLite library
B4X JavaObject-NativeObject
This booklet explains the use of JavaObjects (B4A and B4J) and NativeObjects (B4i)

B4R ExampleProjects
This booklet explains some B4R example projects.

SourceCode
Zip file containing all the source codes.

The current editions are 2.5
All booklets have the same edition number, to avoid confusion.
They cover:
B4A version 12.80
B4i version 8.50
B4J version 10.00
B4R version 4.00

Future booklets:
None in the to do list.

Some of these booklets exist in Spanish:

Español, Spanish.
Translated by Manuel Martinez.
 
Last edited:

Genival Carvalho

Member
Licensed User
@klaus maybe Stock file is missing in IDETabs example.
Error at file EditStock => Activity.Title = "Stock " & Main.StockEditMode
Or Main file is breaked

Regards.
 

klaus

Expert
Licensed User
Longtime User
Thank you for reporting this.
Add the two lines below in the Process_Globals routine in the Main module.
B4X:
Sub Process_Globals
    Public StockEditMode = "ADD" As String
    Public StockSelectedRowID As Int
End Sub
Is amended for the next edition.

Best regards.
Klaus
 

Genival Carvalho

Member
Licensed User
Thank you for reporting this.
Add the two lines below in the Process_Globals routine in the Main module.
B4X:
Sub Process_Globals
    Public StockEditMode = "ADD" As String
    Public StockSelectedRowID As Int
End Sub
Is amended for the next edition.

Best regards.
Klaus

Klaus,

The main file is empty in your booklet example.
Could you, please, add this file here.

Regards,
Genival
 

klaus

Expert
Licensed User
Longtime User
The purpose of this example program is to show the Modules Tab in the IDE with several Modules in the main file.
The content of the new Main module is:
B4X:
Sub Process_Globals
    Public StockEditMode = "ADD" As String
    Public StockSelectedRowID As Int
End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Layout1")

End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

The only difference are the two lines in post #6.

This project is a reduced version of the SQLiteLight4 project from the B4A User's Guide.
 

johnmie

Active Member
Licensed User
Longtime User
Several B4X documentation booklets are available, Download Link.

These booklets cover the four B4X products.
Some don't cover B4R because the subject is not relevant for B4R like Visual Designer.

Example projects with source code are included.

Dear Klaus,
your booklets and your contribution to Seagraves book have been of great help but now I am struggling with Android 26+ and find the help available spread out and not complete.

Do you have (or know of) examples from which a hobby programmer like me could learn how to
  • download files and store in a separate file location (to survive program updates)
  • launch an mp4 file in the exo player
  • open a PDF file in Acrobat Reader
  • etc. ?

thanks for your help,
john m., Geneva/CH
 

klaus

Expert
Licensed User
Longtime User
You should have posted theses questions in the questions forum as they are not directly related to the B4X Booklets.

I am struggling with Android 26+
Did you have a look at this: android.jar / targetSdkVersion / minSdkVersion
download files and store in a separate file location (to survive program updates)
You can use the File.DirInternal folder.
This is a dedicated folder for the program, but it cannot be accessed by other applications.
If you need to access the files from outsides the application you should get the folder with the RuntimePermissions library with:
MyFolder = RuntimePermissions.GetSafeDirDefaultExternal(SubFolder As String)
If you don't want a subfolder, enter an empty string.
Don't use File.DirRootExternal nor File.DirDefaultExternal.
launch an mp4 file in the exo player
I have never played a mp4 file nor used ExpPlayer, did you have a look at this ExoPlayer - MediaPlayer / VideoView Alternative?
open a PDF file in Acrobat Reader
I have used pdf with B4A, just one time for testing quite some time time ago.
 
Last edited:

johnmie

Active Member
Licensed User
Longtime User
You should have posted theses questions in the questions forum as they are not directly related to the B4X Booklets.


Did you have a look at this: android.jar / targetSdkVersion / minSdkVersion

You can use the File.DirInternal folder.
This is a dedicated folder for the program, but it cannot be accessed by other applications.
If you need to access the files from outsides the application you should ger the folder with the RuntimePermissions library with:
MyFolder = RuntimePermissions.GetSafeDirDefaultExternal(SubFolder As String)
If you don't want a subfolder, enter an empty string.
Don't use File.DirRootExternal nor File.DirDefaultExternal.

I have never played a mp4 file nor used ExpPlayer, did you have a look at this ExoPlayer - MediaPlayer / VideoView Alternative?

I have used pdf with B4A, just one time for testing quite some time time ago.

Thank you, Klaus.
This does, unfortunately, not help me any further as the directory thus created plus any content is removed again when the user uninstalls or updates the app. I've found some examples using FileProvider and I'll see if I can solve the problem in this way

john m.
 

DonManfred

Expert
Licensed User
Longtime User
This does, unfortunately, not help me any further
This is not the right place to further discuss it as you already get told
You should have posted theses questions in the questions forum as they are not directly related to the B4X Booklets.
It is still valid. Feel free to create a new Thread for any Issues you have.
 
Top