How can I detect recycling from within a recyclerView adapter, so I can perform an action before it gets recycled?
问题 I have a recyclerview that contains fields with editTexts . When scrolling, the data in the edit texts gets all mixed up or erased due to some functions I use and the views being recycled. This could be completely solved if I could save my data before the view gets recycled. How can I detect that happening from WITHIN the adapter? 回答1: Just add below code in your adapter's onBindViewHolder method: viewHolder.setIsRecyclable(false); so you never lose your data on the scroll. 回答2: The