How to solve this dead lock condition in android edit text
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...
An开发者_如何学Pythony Solution?
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
You coudl have two seperate TextWatchers for your EditTexts and based on the EditText that you edit, you change the other one.
精彩评论