Android Tutorial B4A Beginners Guide

Mitchboo

Member
Licensed User
Hi.

Encountering an issue with Number1 and Number2 in the first program of the Beginner's guide.

I followed everything carefully, but it seems Number1 and Number2 do not really behave as global.

B4X:
Dim Number1, Number2 As Int
is in Sub Globals as instructed, but when the program kept telling me it was the wrong result, I added a MsgBox in CheckResult
B4X:
Msgbox("Value", Number1 + Number2)
And I get 0 (zero).

If I set the value in a line just before, it does display it. It seems these variables do not keep their value between events.

What am I missing ?

TIA
 

klaus

Expert
Licensed User
I tested it and it works.
I thought that it should be Msgbox("Value", (Number1 + Number2))
But even Msgbox("Value", Number1 + Number2) works.
According to your code the number is displayed in the title !

Otherwise post you project as a zip file (IDE menu File / Export As Zip) and I'll have a look at it.

Sorry for answering only now, because today I was HERE.
 

Mitchboo

Member
Licensed User
Thank you Klaus.

I just found what was wrong. I had forgotten to call New in Activity_Create :confused:

PS: You are in a superb area !
 

klaus

Expert
Licensed User
Thank you for reporting this, it was due to the Word to pdf conversion.
A new pdf file is now on the site.
 

MitchBu

Active Member
Licensed User
Page 41 of the Beginner's Guide, it is mentioned :

The project is available in the SourceCode folder:
SourceCode\SecondProgram\SecondProgram.b4a


Could not locate any SourceCode folder in the installation folder. It does not seem there is any archive anymore for download.

Would appreciate pointers.

TIA
 

klaus

Expert
Licensed User
When you download the guide from HERE or from my signature you get a zip file with the guide and the SourceCode folder.
 

MitchBu

Active Member
Licensed User
Well, it seems I have a knack to find missing things. In the same beginners guide, page 180, the tutorial goes :

Let us make an example based on the TestLayoutsAnchors project
(which can be found under the Guide\SourceCode\TestLayoutsAnchors directory):


And it is nowhere to be found :(

Search in the forum does not lead to any positive response, and even a Google search site:b4x.com "TestLayoutsAnchors" does not bring any result. I am starting to suspect that project has been abandonned long ago.
 
Top