johncarl81 / parceler

:package: Android Parcelables made easy through code generation.

Home Page:http://parceler.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How i can send i list RealmObject in to another activity

vfa-tuantt opened this issue · comments

I'm facing with a problem.
I wana to send a list List into another activity.

@Table(name = CL_TABLE_NAME)
@Parcel(
        implementations = arrayOf(MasterRealmProxy::class),
        value = Parcel.Serialization.BEAN,
        analyze = arrayOf( Master::class ))
open class Master( 

): RealmObject() {
}

I pass list master data to another activity by this way.

var listMaster: List<Master>?
var args = Bundle()
args.putParcelable(IntentKey.INTENT_MASTER_DATA, Parcels.wrap(listMaster))

But i got this error:
org.parceler.ParcelerRuntimeException: Unable to find generated Parcelable class for io.realm.RealmList, verify that your class is configured properly and that the Parcelable class io.realm.RealmList$$Parcelable is generated by Parceler.

If you know what is problem happening. Please help me. Thank you so much

Parcels.wrap() doesn't support RealmList by default. You can add support by providing a converter:

@ParcelClass(RealmList.class, converter=...)

or using an ArrayList or one of the other collection types.

@johncarl81

Parcels.wrap() doesn't support RealmList by default. You can add support by providing a converter:

@ParcelClass(RealmList.class, converter=...)
or using an ArrayList or one of the other collection types.

Sorry but I'm using with List<Master> and I tried to use ArrayList<Master> to send data to another activity but that error always shown. . .

how did you use ArrayList?