Reputation: 637
if we have two edittextviews and change the value in one edittextview the value of the other automatically change dynamically.For example if i have a currency converter and when i try to put the dollar value the other edittext value change with respect to dollar value at the same time.
Upvotes: 0
Views: 184
Reputation: 779
In this case, you need to add a TextChangeListener to the first edittext field from which second edittext is taking its input.
firstEdText.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
String input = charSequence.toString(); // This is the text entered in your firstEdittext
secondEdText.setText(charSequence);
}
@Override
public void afterTextChanged(Editable editable) {
}
});
Upvotes: 1