Reputation: 365
I am trying to display some text that the user inputs on a android app. However, all the examples that I can find online require you to hit a button before some text is displayed. Is it possible to display user input without a button?
Upvotes: 2
Views: 156
Reputation: 490
Like mentioned @ligi you can use TextWatcher like this:
EditText editText;
TextView tv;
editText.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) {
tv.setText(s);
}
});
Upvotes: 2