Android: restore RecyclerView item positions after app re-opens

寵の児 提交于 2019-12-06 14:54:06

Add a field called "SortOrder" to your database table and increment the value in this column every time you add a new row. (You could use the MAX function to ensure the value is always the next one up from the current highest)

Sort by this column when retrieving the items.

When you drop a card after dragging it to a new position, update the field with the new sort order/position.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!