Closed PrasannaVenkadesh closed 5 years ago
Currently none of CBL objects are Parcelable. To share that, I would suggest to put it into a global or application level Map/HashMap and share it by key string.
@PrasannaVenkadesh, where are you passing the HashMap
from? If it is an Activity
, there is an idiom for transferring non-parcelable data. The Fragment
defines an interface:
public interface ArgumentProvider<K, V> {
HashMap<K, V> getArguments();
}
... which the Activity
implements. The Fragment
verifies that any Activity
to which it is bound implements this interface (instanceof
) and then requests the value.
Will that work of you? We have an interest in keeping the Dictionary
object pure Java, if that is possible.
@PrasannaVenkadesh Do you need more help with this?
As I said, we intend to keep the Dictionary object pure Java. We would consider, however, making a new class, ParcelableDictionary
, that could be passed across Binder.
I've created https://issues.couchbase.com/browse/CBL-18 to track this issue. Please follow it there.
In one case, I happen to put a Dictionary into a HashMap and pass it to a fragment. This caused a RunTimeException stating, the Parcel was unable to mash the value which is a Dictionary.
Shouldn't Dictionary be Parcelable? or is there better way to share a dictionary?