In an Android app, I have an EditText
and a TextView
. I would like to put the content of the EditText in the IextView in real-time when the user writes something in the EditText.
How can I do that?
Thanks
In an Android app, I have an EditText
and a TextView
. I would like to put the content of the EditText in the IextView in real-time when the user writes something in the EditText.
How can I do that?
Thanks
Use a text change listener:
yourET.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) {
}
@Override
public void afterTextChanged(Editable s) {
yourTV.setText(yourET.getText().toString());
}
});