At times, the value of one TextView is to be replicated into others as a user types the text. Below illustrates how that can be done. In class MainActivity, variable has been declared for the class as below:
TextInputEditText[] array_yourinterest_rate = new TextInputEditText[12];
Within the onCreate method of MainActivity, addTextChangedListener was added to change the values of the views in array_yourinterest_rate as the value of bindMainly.activityMainMyInterest changes as the user types.
Below is the code segment to illustrate how that was done.
bindMainly.activityMainMyInterest.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) {
for (int i = 0; i < 12; i++) {
array_yourinterest_rate[i].setText(s.toString());
}
}
});