Ria Ria - 1 year ago 68
Android Question

How to use EditText onTextChanged event when i press the number?

Hi am having EditText with the "text = 0.00". when i press the number 3 it should be like 0.03 & second time when i press the number 5 the text should be 0.35. And 35.0, 35.09 like this. The EditText initially having the value as 0.00.

These are all done with the same EditText.

How to achieve this.. I have tried on addTextChangedListener() with TextWatcher().

Can Anyone suggest me how to do it...

Thanks in adv.

Answer Source

You have selected correct approach. You have to extend the class with TextWatcher and override afterTextChanged(),beforeTextChanged(), onTextChanged().

You have to write your desired logic in afterTextChanged() method to achieve functionality needed by you.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download