https://kotlinlang.org logo
#android
Title
# android
m

morganbovi

06/07/2017, 7:23 PM
They have a Kotlin example up on their Github, it's kinda small but might help. https://github.com/realm/realm-java/tree/master/examples/kotlinExample
b

ben.slama.jihed

06/07/2017, 7:40 PM
morganbovi: i had this error because i follow this sample step by step 😕 i had resolve the problem thank you
m

morganbovi

06/07/2017, 7:46 PM
What was the fix?
i

ihor.kucherenko

06/07/2017, 8:00 PM
You can just use a constructor with args which have default values
b

ben.slama.jihed

06/07/2017, 8:59 PM
don’t use this syntaxe : (same in kotlin realm example) @RealmClass open class POJO( @PrimaryKey var id: Long ,var title: String ,var content:String ) : RealmObject() {} but use this : @RealmClass open class POJO : RealmObject() { @PrimaryKey var id: Long = 0 var title: String =“” var content: String =“” }
realm need default constructor to work 😕
k

kingsley

06/08/2017, 9:03 AM
@ben.slama.jihed Have you considered the no-arg compiler plugin? See https://kotlinlang.org/docs/reference/compiler-plugins.html#no-arg-compiler-plugin
b

ben.slama.jihed

06/08/2017, 9:15 AM
no i will try that to day 😄
👍 1