Hi James. We try to implement Parcelable interface. Something like this https://developer.android.com/reference/android/os/Parcelable.html. Example on stackoverflow are all around but for maps we cant find anything. HashMap use Serializable.
With primitive types everything is great but when we try to use map type we are in problem. How to use parcable with primitive types: https://gist.github.com/keyboardr/5563038 And also how to put in bundle https://gist.github.com/mmarcon/6660453 Our solution for now look something like this: @Override public void writeToParcel(Parcel dest, int flags) { ParcelableUtils.write(dest, getFrequency()); ParcelableUtils.write(dest, getStartDate()); //dest.writeMap(properties); } public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { public RecurringMetaEntity createFromParcel(Parcel in) { return new RecurringMetaEntity(in); } public RecurringMetaEntity[] newArray(int size) { return new RecurringMetaEntity[size]; } }; private RecurringMetaEntity(Parcel in){ super(Enums.DatabaseType.ORG); setType(DocumentTypeCode.RECURRING_META); setFrequency(ParcelableUtils.readString(in)); setStartDate(ParcelableUtils.readDate(in)); } As you can see we are using primitive types from our properties and then send object to another activity ... when we found better solution I will write in this thread. If someone is interested to see how it really works you can try android application https://play.google.com/store/apps/details?id=net.dzomba.termin3 Hello to all good people! On Thursday, July 28, 2016 at 5:29:17 PM UTC+2, James Nocentini wrote: > > But it looks like Maps can't be serialized as intent extras. The > document.getProperties() method returns a Map<String, Object>. Can you try > to convert it to a HashMap then pass it as an extra? > > James > > On Thursday, 28 July 2016 16:25:55 UTC+1, James Nocentini wrote: >> >> You can pass the HashMap as an intent extra >> <http://stackoverflow.com/a/7578313/1908348>. >> >> James >> >> On Thursday, 28 July 2016 16:15:51 UTC+1, Nenad Stojnic wrote: >>> >>> Hi. >>> >>> Problem description: >>> Activity_A have one Meta object which contains two fields >>> com.couchbase.lite.Document and Map<String, Object>. >>> We need to send Meta object from Activity_A to Activity_B and then we >>> edit Meta object in Activity_B. >>> We want to do it using Intent. >>> Meta object must be Parcable. >>> How can we make that Meta Object is Parcable? >>> >>> -- You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/10e13d90-159b-4f7a-b9cd-67ee3646dd3b%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
