0

I have a RecyclerView with an EditText. When I try to add some value to the EditText and slide down and check the EditText value, the value disappears.

Massimiliano Kraus
  • 3,638
  • 5
  • 27
  • 47
  • Possible duplicate of [Saving EditText content in RecyclerView](https://stackoverflow.com/questions/31844373/saving-edittext-content-in-recyclerview) – Ravee Sunshine Aug 26 '17 at 06:16

2 Answers2

0

As the name suggests, recyclerview are recycled view. Any view created is not a permanent view, once scrolled the view gets recycled and when you scroll back to the same position, it is created again.

The best way you can achieve this is to save the data (database or shared preference, as per your need) in the method onViewRecycled() and to populate that data back in onBindViewHolder()

ABS
  • 1,101
  • 10
  • 27
0

if you want to save the state of a view after recreation. just assign it an Id;

Ehsan.sarshar
  • 119
  • 1
  • 1
  • 6