Трудно поддерживать два разных вывода addOnTextChangeListerner's
в одном и том же textView, поэтому лучше Заменить раздел макета на -
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/labelnama"
android:orientation="horizontal">
<TextView
android:id="@+id/textView_Output1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="25dp"
android:layout_marginRight="2dp"
android:text="Output"
android:textSize="18sp" />
<TextView
android:id="@+id/textView_Output2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="25dp"
android:text=""
android:textSize="18sp" />
</LinearLayout>
и применить addTextChangedListener
к обоим editText и установите их выходные данные в соответствующих TextViews ... как это
final EditText nameEditText = (EditText) findViewById(R.id.name);
final EditText spesificationEditText = (EditText) findViewById(R.id.spesification);
final TextView textViewOutput1 = (TextView) findViewById(R.id.textView_Output1);
final TextView textViewOutput2 = (TextView) findViewById(R.id.textView_Output2);
nameEditText.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) {
String name = nameEditText.getText().toString();
if(name!=null){
textViewOutput1.setText(name);
}
}
@Override
public void afterTextChanged(Editable s) {
}
});
spesificationEditText.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) {
String specification = spesificationEditText.getText().toString();
if(specification!=null){
textViewOutput2.setText(specification);
}
}
@Override
public void afterTextChanged(Editable s) {
}
});
}