android - 使用 DBFlow 数据库时未从列表中获取所有数据
问题描述
I add Some data of list in DbFlow Databse but when I want that data get only one from list .
Here is my code for reference
for(i in path.indices){
val image_off_obj=UserObject()
image_off_obj.image_path=path[i].toString()
image_off_obj.save()
}
下面的语法用于从数据库中获取数据,但我只得到了一个。 //输出 val image_data = SQLite .select() .from(UserObject::class.java) .queryList()
解决方案
使用 autoincrement=true 在数据库中添加一个 ID。像这样:->
@Column
@PrimaryKey(autoincrement = true)
var image_id :Int =0