Java – realmobject and Parcelable
                                        
                    •
                    Java                                    
                I'm new to real for Android, so I'm not sure if I'm getting close to this problem correctly I have a class that looks like this:
public class Entry extends RealmObject implements Parcelable {
    ...
}
The problem is that the Parcelable interface contains methods such as describecontents() writetoparcel(). Realmobjects should not 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 to create a separate class (perhaps like realentry)? Doing so will result in a lot of duplicate code
Solution
Now there is a different solution: just implement the realmmodel interface instead of extending from realmobject:
@RealmClass
public class User implements RealmModel {
}
You can find more information in real documentation
                            The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
                        
                                            
                        THE END
                    
                    
                    
                                                        二维码
                        
                        
                                                
                        