Android Question My First Project

David Troup

Member
Licensed User
Longtime User
I am having great difficulty with My First Project in the Beginner's Guide. There are so many errors coming up when I try to compile it; I just don't know where to go, as a complete novice. Disappointing. Is it possible to publish a code version of each Project Tutorial Project in your Code Snippets? I would welcome a "notepad" version of the code by email to me as I suspect it will take a long time to publish what I am asking for and I can't wait to get "stuck in"!
Kind regards,
David.
 

David Troup

Member
Licensed User
Longtime User
The only problem with this approach is that I do not know how to clear the errors to go on to the next one! I am a complete novice trying to learn from the Beginner's Guide step by step.
Here is the first one:-

Parsing code. Error
Error parsing program.
Error description: Syntax error.
Occurred on line: 18
Sub CheckResult
 
Upvote 0

David Troup

Member
Licensed User
Longtime User
This is what I have input from the notes in the manual:-

Dim btnAction As Button
Dim edtResult As EditText
Dim lblComments As Label
Dim lblMathSign As Label
Dim lblNumber1 As Label
Dim lblNumber2 As Label
Sub btnAction_Click
End Sub

Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Main")
New
End Sub

Dim Number1, Number2 As Int
End Sub

Sub New
Number1 = Rnd(1, 10) ' Generates a random number between 1 and 9
Number2 = Rnd(1, 10) ' Generates a random number between 1 and 9
lblNumber1.Text = Number1 ' Displays Number1 in label lblNumber1
lblNumber2.Text = Number2 ' Displays Number2 in label lblNumber2
lblComments.Text = "Enter the result" & CRLF & "and click on OK"
edtResult.Text = "" ' Sets edtResult.Text to empty
End Sub

Sub btnAction_Click
If btnAction.Text = "O K" Then
If edtResult.Text="" Then
Msgbox("No result entered","E R R O R")
Else
CheckResult
End If
Else
New
btnAction.Text = "O K"
End If
End Sub

Sub CheckResult
If edtResult.Text = Number1 + Number2 Then
lblComments.Text = "G O O D result" & CRLF & "Click on NEW"
btnAction.Text = "N E W"
Else
lblComments.Text = "W R O N G result" & CRLF & "Enter a new result" & CRLF & "and click OK"
End If
End Sub
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Try compiling the app in debug mode, the first error you'll get is Duplicate Sub btnaction_click, You have the line Sub btnAction_Click within your Globals Sub, remove that.

Compile again you get a stack empty error and an End Sub line is underlined in red!, this line shouldnot be here, and you should move the Dim Number1, Number2 As int to within the Globals Sub

The app will now compile. I haven't tested it properly as I do not have the Layout file, if you get more problems , please zip your project (file Export as Zip) and post it to the forum, it makes it easier to help.

Also, please post these type of questions in the "Questions" Forum.
 
Upvote 0

David Troup

Member
Licensed User
Longtime User
Yes, thanks Klaus I have found it all now. So sorry to have bothered you! I find the documentation very good and look forward to working through it all.
Kind regards,
David.
 
Upvote 0
Top