Android Tutorial B4A Beginners Guide

This guide is obsolete ! It is no more updated.
Please use the B4X Booklets.


Here is a Beginner's Guide in pdf format.
The source code for the example programs is included.

All suggestions, remarks and typo reports are welcome.

To know what vesion you have, look at the lower right corner of the cover page there is an Edit number.
Latest version Edit 3.3

Best regards.


EDIT 2016.10.26 Edition 3.3
Updated with the new B4A V6.30 features.
A big thank you to widget who sent me a complete review with suggestions and typos.
Almost all suggestions have been added.

EDIT 2015.12.08 Edition 3.2
Updated with the new B4A V5.50 features.

EDIT 2015.10.14 Edition 3.1
Updated with the new B4A V5.20 features.

EDIT 2015.07.26 Edition 3.0
Updated with the new B4A V5.02 features.

EDIT 2014.06.04 Edition 2.9
Updated with the new B4A V3.80 features.
Amended some typos.

EDIT 2014.05.07 Edition 2.8
Updated with the new B4A V3.50 features.
Amended some typos.

EDIT 2014.02.05 Edition 2.7
Updated with the new B4A V3.20 features.

EDIT 2013.10.13 Edition 2.6
Updated with the new B4A V3.00 features.

EDIT 2013.05.19 Edition 2.5
Updated with more recent Android SDKs.
Updated to Basic4Android Version 2.70
Added some code snippets to B4A Code Snippets.

EDIT 2013.01.20 Edition 2.4
Minor update with the changes of B4A Version 2.5

EDIT 2012.12.27 Edition 2.3
Updated to Basic4Android 2.3
Updated some chapters

EDIT 2012.08.30 Edition 2.2
- Updated to B4A 2.02
- Removed chapters Keywords, Views and Collections moved them in a separate guide Keyword_Views.pdf
- Added Chapter 12. Tools
- Chapter 12 Example Programs becomes 13
- Chapter 13 Basic Language becomes 14
- Chapter 14 Basic Graphics / Drawing becomes 15
- Chapter 15 Keywords removed
- Chapter 16 Views removed
- Chapter 17 Collections rmoved
- Chapter 18 VB6 versus B4A becomes 16
- Chapter 19 FAQ's becomes 17
- Chapter 20 Glossary becomes 18
- Added new chapters to FAQ'schapter
- Chapter 17.39 not yet finished

Two new Guides have been added:
- Keyword / Views / Collections these chapters were in the Beginner's Guide before
- B4A Code Snippets, it's a collection of code snippets I took from the forum.

EDIT 2012.04.11 Edition 2.1
- Added chapter 5.3 Screen Orientations
- Added chapter 6.4 Exchanging files with PC
- Added chapter 8.9 Designer Script
- Added chapter 13.5.3 Calling a Sub from another module
- Added chapter 13.11 Lists
- Added chapter 13.12 Maps
- Added chapter 17 Collections
- Chapter 17 becomes 18
- Chapter 18 becomes 19
- Added chapter 19.25 Detect screen orientation
- Added chapter 19.26 Some functions don't work in Activity_Pause
- Added chapter 19.27 Calling internal Calculator
- Added chapter 19.28 Get the Alph / Red / Green / Blue values

EDIT 2012.03.11 Edition 2.0
- Amended some errors
- Updated to B4A version 1.8
New chapter
- Working with different screen sizes / number of layouts

Removed chapters
- SQL moved to the User's Guide
- GPS moved to the User's Guide

EDIT 2012.01.01 Edition 1.6
- Added the Widget tutorials.
- Amended some errors.

EDIT 2011.12.25 Edition 1.5
- Added the GPS Example program with some explanations of the code.
- Added some subchapters inspired by forum questions.

Edit: 2011.11.01 Version 1.4
New chapters:
- 8.7 The Abstract Designer
- 8.8 Adding views by code
- 12.5 GPS (a new GPS program will be added in the next update)
- 13.7 Basic Language / Events
- 13.10 Basic Language / Files
- 18.xx some new FAQ's

Edit: 2011.08.29 Version 1.3
New chapter:
- 18 FAQ's

Edit: 2011.08.15 Version 1.2
Above chapters have been added.

Edit: 2011.06.12 Version 1.1
Still missing chapters:
Modules
Example Programs
- ScrollView example
- Database example
Basic Language
- String manipulations
- Timers
Graphics
 
Last edited:

Arnoud

New Member
Beginner's Guide page 33

Hi Klaus,

This month I started with B4A and the Beginner's Guide. I made "FirstProgram.b4a" in the evaluation period. Then I paid for B4A, and continued with "SecondProgram.b4a". Right away I discovered two things that didn't go according to plan.

First, when setting the package name for "SecondProgram.b4a" as "B4A.SecondProgram", B4A won't accept capital letters anymore. I suspect this is an update or something.

Then, after adjusting the program and compiling it, it refused to run. I discovered that copying the the "MyFirstProgram" folder to "SecondProgram" and renaming "MyFirstProgram.b4a" to "SecondProgram.b4a" wasn't enough. You also have to delete the "Objects" directory, otherwise this procedure won't work! :signOops:

I hope I can be of help with these comments.

Kind regards,

A beginner
 

klaus

Expert
Licensed User
Longtime User
Thank you for your remark.
I already changed this in the original file.
The new version will be published soon with some changes.
The Beginner's Guide will be somewhat shorter, but a new User's Guide will come with some of the chapters of the Beginner's Guide and new chapters.
Sorry but no precise schedule yet.

Best regards.
 

ThePuiu

Active Member
Licensed User
Longtime User
Disaplay DateTime into Label

Hi, first of all i want to apologise for my english!
This is my first post here (so, i hope it is in a right place). From few days i'm learning B4A and now i have one question: i try to read some data from a SQL Server (inspired from Erel tutorial)...everything is fine except displaying DateTime value in a Label. I want to have this date format: DateTime.DateFormat = "dd/MM/yyyy". I try to do like this:
Label.Text = DateTime.Date(m.Get("DATE_START")) but i receive this error: java.text.NumberFormatException:/Date(1212267600000)/
The result from SQL interogation is something like: 2009-07-20 00:00:00.000
Result from aspx is like: ..."DATE_START":"\/Date(1212267600000)\/"....
So, please, what can i do?
 

Arnoud

New Member
Using the debugger

Hi,

In the Beginner's Guide (edition 1.6) on page 62 there is mentioned that in the B4E IDE in the menu under 'Project' there are two options for debugging: the 'Include Debug Information' check and the 'Attach Debugger' check.

In my B4A IDE (version 1.80) these options are not there. There is something else however: in the toolbar one is able to choose between 'Debug', 'Release' and 'Release (obfuscated)'.

I figured out that in the 'Debug' state, the apk will contain debugging code, and in the 'Release' state it will not.

I'm not sure what the 'Release (obfuscated)' state does.

Does anyone know?

Kind regards,
 

klaus

Expert
Licensed User
Longtime User
Hi Arnoud,
The choice of the debugger has changed in B4A version 1.8.
It has been be updated in the next version of the Beginner's Guide that will be published quite soon.

I'm not sure what the 'Release (obfuscated)' state does.
Have a look here.

Best regards.
 

JosephG

New Member
Licensed User
Longtime User
Hello everyone. I'm a brand new user of B4A, just upgraded from trial to paid, and I would never have been willing to do it if I hadn't found you guide first Klaus.

A true and sincere Thank-you!

I don't have any prior programming knowledge or experience but have so far been able to keep up and follow along with the first two examples in your guide and I think I am getting a working knowledge of how it all works.

I am now moving forward in the guide and am examining the user interfaces examples and had a question that I could not figure out from the guide and was hoping you or anyone else here could point out what I'm sure is the simple and obvious point I have missed.

In the 'Menu' example, going to the Designer shows the Main layout as well as those for the Pages (1, 2, and 3). For the other two examples (tabhost view and button toolbox) the designer only lists the Main view even though the code used the Page1, 2, and 3 layouts and I can see them displayed when the program is run on the emulator. Where do the Page layout files exist or where can they be seen in those later two examples.

Again, I'm sorry to ask what I'm sure seems like a silly question, especially after you have already helped me so much through all your hard work you already put into this guide. No matter what follows from here, another deep Thank-you Klaus for bringing the noobs like me into the fold.
 

klaus

Expert
Licensed User
Longtime User
Thank you for your comment, I'm glad that the guide is helpful for you.
In the 'Menu' example, going to the Designer shows the Main layout as well as those for the Pages (1, 2, and 3). For the other two examples (tabhost view and button toolbox) the designer only lists the Main view even though the code used the Page1, 2, and 3 layouts and I can see them displayed when the program is run on the emulator. Where do the Page layout files exist or where can they be seen in those later two examples.
Sorry, that's a mistake in the source code file. The three files are in the Files folder of the project but they are not added in the Files Tab. The are displayed when running the program because they are in the projects Files folder but they don't appear in the Designer because they are not added in the Files Tab.
In the mean time you can adding the files in the Files Tab from the projects files folder.

Thank's for pointing this out, it will be updated in the next version of the guide.

Best regards.
 

JosephG

New Member
Licensed User
Longtime User
I'm glad to hear they do really exist and aren't just some voodoo magic settings.

I appreciate the explanation and another Thank-you for your great guide.
 

klaus

Expert
Licensed User
Longtime User
A new version of the Beginner's Guide is available (link in the first post):

Edition 2.0
- Amended some errors
- Updated to B4A version 1.8

New chapter
- Working with different screen sizes / number of layouts

Removed chapters
- SQL moved to the User's Guide
- GPS moved to the User's Guide
These chapters have been removed from the Beginner's Guide and moved to the new User's Guide.

Best regards.
 
Last edited:

Ebass

New Member
Licensed User
Longtime User
Thanks!

Klaus:

Im one who loves read User Guides, I have read a lot, most from Microsoft, Adobe, Macromedia(now Adobe) and Metacreations, your work its great so professional.

Please keep it that way, if in any time need some help(an I could help, testing or making screen shoots, or just bringing some nice words), just ask.

Again great work!!!

Im starting with Basic4Android, but this makes very easy way!
 

jeeradate

Member
Licensed User
Longtime User
Without your Beginning Guide, I cannot getting start to learn the B4A.
Thank you for your kind contribute.
I start learning how to program with B4A at 60'.
 

tanghali

New Member
Licensed User
Longtime User
I want to word version, thank you

Hello, some of the content I cannot read,:eek: a translation is required, you can give me a word version? My e-mail address: [email protected], thank you:)
 

klaus

Expert
Licensed User
Longtime User
A new version 2.2 of the Beginner's Guide is available.
Look at the first post for update details.
The three chapters Keyword, Views and Collections have been removed and put in a separate guide.
A new Guide B4ACodeSnippets is also included it contains a collection of code snippets I gathered in the forum.

Best regards.
 
Top