Muniu
Muniu

Reputation: 187

Android View losing data on scroll

I have an application made up of an ExpandableList, whose children are data collection widgets like CheckBoxes and EditText. Once data is entered, it is immediately lost when the list is scrolled. What may be the problem or solution? Thanks.

Upvotes: 0

Views: 1234

Answers (1)

Muniu
Muniu

Reputation: 187

Found a link that explains the problem and/or solution

EditText items in a scrolling list lose their changes when scrolled off the screen

List rows get recycled. Your Cursor may have 1,000 records, but there are not going to be 1,000 EditText widgets created if you scroll through the list. Rather, there will be 10 or so, depending on how many rows are simultaneously visible. Rows get recycled, and the binding operation will replace the old EditText value with a new value from the Cursor for whatever row just scrolled onto the screen, replacing whatever was there before (previous value from the database or a user-edited value).

Upvotes: 1

Related Questions