michal2616
michal2616

Reputation: 117

Saving Kotlin ByteArray into Realm

I want to save bitmap into Realm DB. I converted bitmap into ByteArray and created Realm model class:

    @RealmClass
    open class PictureModel : RealmObject() {

    @PrimaryKey
    var id: String = ""
    var picture : ByteArray = byteArrayOf()
    }

but during compilation it gives me an error:

w: warning: Unclosed files for the types; these types will not undergo annotation processing

Realm is supposed to support java byte[] but what about Kotlin ByteArray or Array<Byte>

Upvotes: 2

Views: 1385

Answers (1)

Sahjad Ansari
Sahjad Ansari

Reputation: 110

Try this :

open class Test : RealmObject() {

    @PrimaryKey
     var id: String? = null
    var picture: ByteArray? = null
}

Upvotes: 2

Related Questions