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.
Dim edittextall(3) As EditText
Dim btnsall(3) As Button
Dim units(3) As String =Array As String ("Ω","ΚΩ","ΜΩ")
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer.
For i=0 To 2
If i<2 Then
edittextall(i).Initialize ("edittext")
edittextall(i).InputType=edittextall(i).INPUT_TYPE_NUMBERS
Else
edittextall(i).Initialize ("edittextFinal")
edittextall(i).InputType=edittextall(i).INPUT_TYPE_NONE
edittextall(i).Enabled=False
End If
Activity.AddView (edittextall(i),0,i*20%y,50%x-1dip,20%y-1dip)
btnsall(i).Initialize ("btnsall")
btnsall(i).Text=units(0)
btnsall(i).Tag=0
Activity.AddView (btnsall(i),50%x,i*20%y,50%x-1dip,20%y-1dip)
Next
End Sub
Sub edittext_textChanged(old As String, new As String)
Calculate
End Sub
Sub EditTextFinal_FocusChanged (HasFocus As Boolean)
If HasFocus Then
edittextall(0).RequestFocus
End If
End Sub
Sub Calculate
If edittextall(0).Text.Length >0 AND edittextall(1).Text.Length >0 Then
Dim Val1 As Double, val2 As Double, Val3 As Double
Val1 = edittextall(0).Text
val2 = edittextall(1).Text
Val3 = Val1 + val2
edittextall(2).Text = Val3
Else
edittextall(2).Text="N/A"
End If
End Sub
Sub btnsall_Click
Dim count As Int, tempBtn As Button
tempbtn=Sender
count=tempBtn.Tag
count=(count+1) Mod 3
tempBtn.Text=units(count)
tempBtn.Tag=count
End Sub