feresr feresr - 2 years ago 305
Android Question

RealmObject AND Parcelable

I'm new to Realm for Android so I'm not sure I'm approaching this the right way. I have a class which looks like this:

public class Entry extends RealmObject implements Parcelable {

The problem is the
interface contains methods like
and RealmObjects aren't supposed to have methods other than getters and setters:

Error:(81, 17) error: Only getters and setters should be defined in model classes

So my question is: How can I make these two work together? Is there a better way than creating an separate class (maybe something like
)? Doing so would result in a lot of duplicated code...

Answer Source

Now there's a different workaround for that: just implement the RealmModel interface instead of extending from RealmObject:

public class User implements RealmModel {


You can find more information in the Realm Documentation.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download