如何将我的 Arraylist 保存到 SQLite 数据库中? [英] How to save my Arraylist into SQLite database?
问题描述
我想保存我的ArrayList
在 SQLite 数据库中,然后检索它以显示存储在其中的项目.我怎样才能做到这一点?请举例说明.提前致谢:)
I want to save my
ArrayList<HashMap<String, String>> mylist = new ArrayList<HashMap<String, String>>()
in SQLite database and later retrieve it to display the items stored in it. How can I achieve this?
Please provide examples.
Thanks in Advance :)
推荐答案
请参考上面的链接.我有一个使用 HashMap 使用 SQliteOpenHelper 进行 SqlLite 操作的工作示例.它一次插入一个,但如果您希望在一个实例中将它们全部插入,您可能想要创建一个循环.
Please refer to the link above. I has a working example of using HashMap for SqLite operations using SQliteOpenHelper. It has one insertion at a time, but you might wanna create a loop, if you wish to insert them all in one instance.
这篇关于如何将我的 Arraylist 保存到 SQLite 数据库中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!