I have three EditText and I need to check if the first EditText is empty and if the second EditText is also empty.
Affirmative case I should disable the third EditText.
How can I do this?
I have three EditText and I need to check if the first EditText is empty and if the second EditText is also empty.
Affirmative case I should disable the third EditText.
How can I do this?
A simple case that could sacionar your problem would be, if clicking on the editText, it does these checks and validations for you
editText1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String editText1_text = editText1.getText().toString();
String editText2_text = editText2.getText().toString();
if(editText1_text == null && editText2_text == null)
editText3_text.setVisibility(GONE);
else if(editText1_text != null && editText2_text != null)
editText3_text.setVisibility(VISIBLE);
}
});
editText2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String editText1_text = editText1.getText().toString();
String editText2_text = editText2.getText().toString();
if(editText1_text == null && editText2_text == null)
editText3_text.setVisibility(GONE);
else if(editText1_text != null && editText2_text != null)
editText3_text.setVisibility(VISIBLE);
}
});