Dawid Hyży Dawid Hyży - 2 years ago 99
Android Question

How to send RealmObject in Bundle?

How to pass RealmObject through the Intents Bundle? Is there an way to write RealmObject to parcel?
I don't want to use Serializable for know reasons.

Answer Source

The easiest solution is to use Parceler: https://realm.io/docs/java/latest/#parceler

For example:

// All classes that extend RealmObject will have a matching RealmProxy class created
// by the annotation processor. Parceler must be made aware of this class. Note that
// the class is not available until the project has been compiled at least once.
@Parcel(implementations = { PersonRealmProxy.class },
        value = Parcel.Serialization.BEAN,
        analyze = { Person.class })
public class Person extends RealmObject {
    // ...
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download