2
all right? I’m having trouble with the Textwatcher. Like, I created two "plaintext" that I named "et_texto1" and "et_texto2", when I write something in "et_texto1" it has to appear the word "Pleasure!" in "et_texto2" and when I write something in "et_texto2", the word "Hello" in "et_texto1" has to appear, but the way I put it, is giving conflict, could someone help me fix this problem? Follow my code right below!
EditText et_texto1, et_texto2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
et_texto1 = (EditText) findViewById(R.id.et_texto1);
et_texto2 = (EditText) findViewById(R.id.et_texto1);
et_texto1.addTextChangedListener(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) {
et_texto2.setText("olá");
}
@Override
public void afterTextChanged(Editable s) {
}
});
et_texto1.addTextChangedListener(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) {
et_texto2.setText("Prazer!");
}
@Override
public void afterTextChanged(Editable s) {
}
});
}
}```