I'm working with Realm to create my android app's ORM with Realm. The problem is that when I try to create an object like this:
public class Airport extends RealmObject {
private int Id;
private String Name;
private String Code;
private RealmList<Integer> destinations;
}
androidStudio tells me that I can't have the RealmList with type Integer; and for String type either. I've been looking a few similar questions, but the best approach is to declare an object like:
public class MyRealmInteger extends RealmObject {
private int destination;
}
so this way I can rewrite my class as follows:
public class Airport extends RealmObject {
private int Id;
private String Name;
private String Code;
private RealmList<MyRealmInteger> destinations;
}
but I think it's a very complicated. There isn't any other easier solution?
but I think it's a very complicated. There isn't any other easier solution?
No there is not. Not yet at least. They're "working on it":
This feature is among a handfull of top features that we hope to take on next. We will however give the current 1.0 a bit of peace to ensure stability before we push a lot of new features.
You can check this issue for updates on it https://github.com/realm/realm-java/issues/575
Please take a look at this answer https://stackoverflow.com/a/46576569/3479489 realm will add support for primitives in the version 4.0.0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With