this is my code
this my screenshot
B4X:
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 BD As BetterDialogs
Dim btn1 As Button
Dim btn2 As Button
Dim btnAns As Button
Dim lbl1 As Label
Dim btn01 As Button
Dim btn02 As Button
Dim Listview1 As ListView
Dim btnMain As Button
Dim AnsV As Int
Dim btnR As Int
Dim btnI As Int
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("0")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub CalV
btnR = btn1.Text
btnI = btn2.Text
AnsV = btnR*btnI
'btnAns.Text = btn1.Text*btn2.Text
lbl1.Text = "V = I * R" & CRLF & CRLF & "R = " & btn1.Text & " Ω" & CRLF & "I = " & btn2.Text & " A" & CRLF & CRLF & "V = " & btn1.Text & " v * " & btn2.Text & " Ω" & CRLF & "V = " & AnsV & " v"
End Sub
Sub btnAns_Click
CalV
End Sub
Sub btn2_Click
Dim Dr As Int
' Input box
Dim I As BD_InputBoxParams
I.Initialize
I.Question = "<I>Current (I)</I>"
I.QuestionTextSize = 18
I.SpaceBetween = 4dip
I.InputTextSize = 24
I.InputType = I.INPUT_TYPE_DECIMAL_NUMBERS
I.Gravity = Gravity.CENTER_VERTICAL + Gravity.CENTER_HORIZONTAL
I.ValidationCallback = "Input_Validation"
I.WithSuggestions = True
Dr = BD.InputBox("The Value of Current (I)", I, "OK", "Cancel", "", "")
Log("DR=" & Dr)
If Dr = DialogResponse.POSITIVE Then
Log(I.Answer)
Log(I.CompactAnswer)
btn2.Text = I.Answer
End If
End Sub
Sub btn1_Click
Dim Dr As Int
' Input box
Dim IP As BD_InputBoxParams
IP.Initialize
IP.Question = "<I>Resistance (R)</I>"
IP.QuestionTextSize = 18
IP.SpaceBetween = 4dip
IP.InputTextSize = 24
IP.InputType = IP.INPUT_TYPE_DECIMAL_NUMBERS
IP.Gravity = Gravity.CENTER_VERTICAL + Gravity.CENTER_HORIZONTAL
IP.ValidationCallback = "Input_Validation"
IP.WithSuggestions = True
Dr = BD.InputBox("The Value of Resistance (R)", IP, "OK", "Cancel", "", "")
Log("DR=" & Dr)
If Dr = DialogResponse.POSITIVE Then
Log(IP.Answer)
Log(IP.CompactAnswer)
btn1.Text = IP.Answer
End If
End Sub
Sub btn01_Click
Activity.LoadLayout (1)
btn01.Visible = False
btn02.Visible = False
End Sub
Sub btn02_Click
End Sub
Sub Input_Validation(Answer As String, CompactAnswer As String) As String
If CompactAnswer = "" Then
Return "Cannot be empty"
Else
Return ""
End If
End Sub
Sub btnMain_Click
Activity.LoadLayout (0)
btn1.Visible = False
btn2.Visible = False
btnAns.Visible = False
btnMain.Visible = False
End Sub
this my screenshot