【发布时间】:2021-04-01 13:12:44
【问题描述】:
我制作了一个显示多行值的 TextView
我想将该值保存在 SQLite 数据库中。这是我使用的代码:
public void AddContact(Contact c)
{
SQLiteDatabase db=this.getWritableDatabase();
ContentValues cv=new ContentValues();
cv.put("nom",c.getNom());
Scanner s = new Scanner(String.valueOf(cv));
while (s.hasNextLine()){
String line = s.nextLine();
db.insert("contact",line,cv);
}
问题是当我保存值时,整个值被插入到一个单元格中。我希望将值每行分开,然后插入到每行的单个单元格中,尽管我正在使用带有插入数据的扫描仪方法,但它不起作用。 有什么办法吗?
【问题讨论】:
标签: java android database sqlite android-sqlite