I am using the parcel object to pass the value from one process to another. I want to create a clone of the parcel object but I am not able to use clone() method If anyone knows how to create the copy of parcel please provide the solution.
The suggested solution is incomplete and will not work.
Here's a working solution:
(I have an object called message of type MessageDescriptor which I want to clone)
Parcel parcel = Parcel.obtain();
message.writeToParcel(parcel, 0);
parcel.setDataPosition(0);
MessageDescriptor messageToBeSent = MessageDescriptor.CREATOR.createFromParcel(parcel);
parcel.recycle();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With