Android Question Formating EditText for Input Type Number

incendio

Well-Known Member
Licensed User
Longtime User
Hi guys,

I have an EditText, input type is number, and its value is 250000.

When it get focus, I want display its value as 250000, but when it losses focus, I want to display its value as 250,000.

Since there is no getfocus event in EditText, is this possible to do that?

Thanks in advance.
 

incendio

Well-Known Member
Licensed User
Longtime User
EditText has RequestFocus, try that.
Yes, it has a RequestFocus, but I don't know how to implement what I want with RequestFocus, since RequestFocus is driven by programmer.

What I need is an event, driven by users, when users clicks EditText, there is an event captured. Using this event I can program to format EditText before users doing some edits.
 
Upvote 0

incendio

Well-Known Member
Licensed User
Longtime User
You can handle the Click event. It doesn't show in the list of events however all views implement it.
Thanks for your replied, but it didn't work well. It must be clicked twice before the click event triggered.

Also, when there are more than one EditText, for ex, EditText1 & EditText2.
EditText1 is the first order, EditText2 is the field where I want to format its value.

When focus in EditText1 then clicked Next Button in virtual keyboard, focus moved to EditText2, but event not triggered too. I must still click one more time to trigger it.

Here are my codes
B4X:
Sub EditText2_Click
    Msgbox("1","")
End Sub
 
Upvote 0
Top