Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
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.
Private Button1 As Button
Private Label3 As Label
Private lblnumber1 As Label
Private lblnumber2 As Label
Private lblResult As Label
Private txt1 As EditText
Public num1,num2 As Int
Private btnNumcreate As Button
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")
Activity.LoadLayout("calculator")
New
End Sub
Sub New
num1=Rnd(1,10)
num2=Rnd(1,10)
lblnumber1.Text=num1
lblnumber2.Text=num2
lblResult.Text=""
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Button1_Click()
If txt1.Text="" Then
lblResult.Text=""
Msgbox("No Result Entered!","ERROR")
Else
CheckResult
End If
End Sub
Sub CheckResult
If txt1.Text=(num1+num2) Then
lblResult.Text="Correct!"
Else
lblResult.Text="Wrong!"
End If
End Sub
Sub btnNumcreate_Click()
lblnumber1.Text=Rnd(1,10)
lblnumber2.Text=Rnd(1,10)
lblResult.Text=""
txt1.Text=""
End Sub