Android 如何将列表存储到sqlitedatabase中?

Android 如何将列表存储到sqlitedatabase中?,android,emulation,contacts,store,sqlite,Android,Emulation,Contacts,Store,Sqlite,我需要将联系人列表存储到sqlite数据库中。我已使用联系人内容提供程序在项目应用程序中显示联系人。我只需要将emulator中的列表存储到数据库中。有人知道怎么做吗?请帮忙,谢谢。没什么大不了的 将您的ContactModel转换为ContentValue: ContentValues values = new ContentValues(); values.put("name", name); values.put("number", number); 然后将其插入数据库: databas

我需要将联系人列表存储到sqlite数据库中。我已使用联系人内容提供程序在项目应用程序中显示联系人。我只需要将emulator中的列表存储到数据库中。有人知道怎么做吗?请帮忙,谢谢。

没什么大不了的

将您的
ContactModel
转换为
ContentValue

ContentValues values = new ContentValues();
values.put("name", name);
values.put("number", number);
然后将其插入数据库:

database.insertOrThrow(databaseTable.getTableName(), null, values)
但请记住,从SQLite数据库获取联系人的速度总是与从
ContentProvider
获取联系人的速度一样快,因为这是一种非常相似的技术