I have been searching for an answer to this, but the solutions don\'t seem to work for me. I have a TextView and an EditText in a list item. I am trying to update the stored v
I've had that same problem, when I move the scrolling to my list up / down the text value of my editText changed,then my solution was that in my EditText add a setOnFocusChangeListener and within it add a addTextChangedListener but relationed whit other instance of the same editText.
EditText etSumScans;
@NonNull
@Override
public View getView(final int position, @Nullable View convertView, @NonNull ViewGroup parent) {
view = convertView;
if (view == null)
view = LayoutInflater.from(myContextItem).inflate(resourceLayoutItem, null);
shipmentLinesDTO = myListItem.get(position);
etSumScans = view.findViewById(R.id.etSumScans);
etSumScans.setText(shipmentLinesDTO.getAttribute1() );
etSumScans.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (!hasFocus){
EditText secondInstanceEditText= v.findViewById(R.id.etSumScans);
secondInstanceEditText.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) {
getItem(position).setAttribute1(s.toString());
}
});
}
}
});
}
With this I solved my problem. I hope helps.