0

(Image 1 & Image 2)

enter image description here enter image description here


(Image 3)

enter image description here


I'm currently using the Epoxy library instead of RecyclerView. However, since Epoxy is built on the basis of RecyclerView, let's just call it RecyclerView.

Problem 1 . (Image 1 & Image 2)

When i return to another screen after entering a value in the EditText of the RecyclerView item, the entered data is moved randomly.

Problem 2 . (Image 3)

After adding enough items to be scrollable, i also enter values ​​into the EditText. And if i scroll down and come back, the data is moved to a random location.

Please tell me what is the reason and what is the proper solution.

ybybyb
  • 1,385
  • 1
  • 12
  • 33
  • 1
    RecyclerView recycles views. If you don't back up the text of an EditText to the model item data as it is typed and restore it in `onBindView`, you'll just see previous text that was in the view when it was last recycled. I don't use Epoxy, but this issue seems to address how to do this in Epoxy: https://github.com/airbnb/epoxy/issues/426 – Tenfour04 Nov 15 '21 at 21:01
  • Sorry, but I'm not sure how the content of the git link relates to my question – ybybyb Nov 17 '21 at 17:39
  • 1
    It's exactly what you're trying to do. Feed back EditText changes into the model so they persist when they scroll away and come back. The developer explanation of how to do it looks very complicated. I don't use Epoxy. Maybe it just isn't a good tool when you have interactive widgets in your RecyclerView. From browsing the Epoxy documentation, it looks like something that helps if you have multiple view types and data binding, but otherwise makes things a lot more complicated than ListAdapter. It does predate ListAdapter. Also, there is ConcatAdapter now which can combine list types easily. – Tenfour04 Nov 17 '21 at 17:41
  • I mean, I didn't understand the question itself in that link.. The answer to that question seems to be similar to what I'm trying to ask, but I didn't understand the question itself.. – ybybyb Nov 17 '21 at 18:10

1 Answers1

1

Make sure you're overriding getItemViewType, getItemId and getItemCount properly.

cmak
  • 576
  • 1
  • 4
  • 15