在数据库插入后刷新listView [英] Refresh an listView after insert on database
本文介绍了在数据库插入后刷新listView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
$ b $有人可以解释一下如何做到这一点?甚至以不同的方式..
解决方案
当点击删除按钮时,请执行以下操作:
- 从数据库中删除相应的列表项。
- 通过执行再次填充列表的查询为您的列表获取一个新的游标。
- 使用 changeCurosr()。
- 调用 notifyDataSetChanged()。
I want to refresh the listView after an insert or delete in the database.. I search and i found notifyDataSetChanged () but i don't know how to use it..
Someone can explain how to do this? Even by a different way..
解决方案
When the delete button is clicked do the following:
- Delete the corresponding list item from the database.
- Get an new cursor for your list by executing the query which fills the list again.
- Bind the new cursor to the list using changeCurosr().
- Call notifyDataSetChanged() on the adapter.
这篇关于在数据库插入后刷新listView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文