Domanda

I have two edit text control and i want to update the second edit text value when first edit text value is entering or vice versa. For that i used onTextChanged(..) method but the problem is while value updation(not input) time it calls onTextChanged(..) method so it gives improper result..

For example : If i enter 20 in edittext1 and the result on edittext2 to should be 40(Some calculation ex: Edittext1 multiply by 2).

If i enter 20 in edittext2 and the result on edittext1 should be 10( Some calculation ex:Edittext2 devided by 2).

Problem is: while showing result on edittext2 its onTextChanged method is called same time it changes the edittext1's input value...

Any Solution?

È stato utile?

Soluzione

I think you can use it by TextChangedListener and maintain two flags be it boolean or int and change the value of each flag accordingly may solve your Problem....

Best Of Luck

Altri suggerimenti

You coudl have two seperate TextWatchers for your EditTexts and based on the EditText that you edit, you change the other one.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top