I have a form with two editext and condition is only one should be enable when we enter value to any of edittext e.g We have 2 edittexts ...Edittext1 and Editext2 case 1: When we type edittext1 then editext2 should be disable and greyout. Case 2 : when we type editext2 the editext1 should be disable and greyout. enter image description here
I had tried using textwatcher but couldn't find the logic.
TextWatcher cupToDup = new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
String cupTOdup = et_cup_to_dup.getText().toString().trim();
et_dup_to_cup.setFocusable(false);
//et_dup_to_cup.setText(" ");
et_dup_to_cup.setEnabled(false);
}
@Override
public void afterTextChanged(Editable s) {
}
};
TextWatcher dupTocup = new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
String dupTocup = et_dup_to_cup.getText().toString().trim();
et_cup_to_dup.setFocusable(false);
//et_cup_to_dup.setText(" ");
et_cup_to_dup.setEnabled(false);
}
@Override
public void afterTextChanged(Editable s) {
}
};