我想将位图保存到 Realm 数据库中。我将位图转换为 ByteArray 并创建了 Realm 模型类:
@RealmClass
open class PictureModel : RealmObject() {
@PrimaryKey
var id: String = ""
var picture : ByteArray = byteArrayOf()
}
但是在编译过程中它给了我一个错误:
w: warning: Unclosed files for the types; these types will not undergo annotation processing
Realm 应该支持 java byte[]
但是 Kotlin 呢 ByteArray
或Array<Byte>
最佳答案
试试这个:
open class Test : RealmObject() {
@PrimaryKey
var id: String? = null
var picture: ByteArray? = null
}
关于android - 将 Kotlin ByteArray 保存到 Realm 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57234055/