In Android, inside a Layout you insert an EditText, it’s that text field you wanted where you can write text into it and also listen to text changes so you can do those manipulations you were talking about.
Create a TextWatcher and add it to the EditText using addTextChangedListener(TextWatcher variable)
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) {
}
};
Add your text manipulation functionality inside these callbacks, hope that’s a good direction for you
TIP: create your own class for a custom text field and extend from EditText, now every where you place that custom view you will have the text manipulation functionality, you could addTextChangedListener from within that class.
solved Android Studio (Java) Replace function [closed]