Android Question question please

Kawther

New Member
Hi every body .
I am a new here , I just begun to study a magazine of (build your own app) and I am happy to be one of the your community .
I read and i start good until first example about ( Temperature Converter ) I don't know why show me an error at line 46 in code .
I do every thing like an example and tried to solved but no way .
please could you help me and see the equation if true or no ???
B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

    Private tempreture As EditText
    Private ctof As Button
    Private ftof 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(" tempreture")
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub
Sub ctof_Click
Dim result As Float

[COLOR=#ff4d4d]line 46 ( here an error )  [/COLOR]result=(( tempreture.Text+40)*9/5)-40)
Msgbox(NumberFormat(result,1,2)"The value in Fahrenheit is")
tempreture.text=""
End Sub

.
 

KMatle

Expert
Licensed User
Longtime User
If tempreture.text is not a number you will get an error in this line. Change the input format (designer) to decimal numbers.

Please don't add any changes (color) because it makes the code harder to read and to help :) As Erel said, post the error (see logs), too.
 
Upvote 0

RandomCoder

Well-Known Member
Licensed User
Longtime User
Looks to me like your missing a comma in the MsgBox immediately after the first close bracket. ;)
 
Upvote 0

James Chamblin

Active Member
Licensed User
Longtime User
The error you get is "Error description: Invalid number of parentheses."

Remove the closing parenthesis at the end so it reads
result=(( tempreture.Text+40)*9/5)-40

Don't be surprised if other errors pop up after fixing this one, debugging is part of the programming process. :)
 
Upvote 0
Top