Android Question format edittext

lolo32

Member
Hello,
I have an integer which represents the number of digits after the decimal point.
in an edittext, I would like to be able to enter a number.
if I write "12598" for example, I would like the edittext to display:
if integer = 0 then "12598"
if integer = 1 then "1259.8"
if integer = 2 then "125.98"
if integer = 3 then "12.598"
.....
how to do ?

Thank you and good day.
 

DonManfred

Expert
Licensed User
Longtime User
Use Numberformat to format a Number.
 
Upvote 0

Vellad

Member
Licensed User
Longtime User
I tried this code, working good
Sub Globals
Dim EditText1 As EditText
Dim EditText2 As EditText
Dim EditText3 As EditText
Dim Button1 As Button
Dim A,B,C As Int
Dim D As Float
'These global variables will be redeclared each time the activity is created.
End Sub

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

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub Button1_Click
A = EditText1.Text
B = EditText2.Text
C= Power (10,B)
D=A/C
EditText3.Text = D
End Sub
 
Upvote 0

Vellad

Member
Licensed User
Longtime User
Make Decimal Places:
Sub Globals
Dim EditText1 As EditText
Dim EditText2 As EditText
Dim EditText3 As EditText
Dim Button1 As Button
Dim A,B,C As Int
Dim D As Float
'These global variables will be redeclared each time the activity is created.
End Sub

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

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub Button1_Click
A = EditText1.Text
B = EditText2.Text
C= Power (10,B)
D=A/C
EditText3.Text = D
End Sub
 
Upvote 0
Top