Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用一个列表视图,我在其中拖放列表项,但是当我关闭该活动并重新启动相同的列表活动时,这些项目将恢复到与数据库中相同的位置,我应该如何以及何时更新我的数据库为了这。
You could use an extra 'index' field in your database to store the position, and then order the query using it. The onStop() method of your activity or fragment would be a good place to update those indexes in your data base.