I have a class (below) that I want to send to a Service Class through an Intent. I have implemented the Parcelable interface but am unsure how to actually send and retrieve the
In your writeToParcel function, you need to write which state objects you want to the Parcel, for instance:
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(urlPath);
dest.writeString(hostname);
}
It doesn't matter which order you write the objects, so long as you read them back in in the same order:
@Override
public UrlParamsHelper(Parcel in) {
urlPath = in.readString();
hostname = in.readString();
}
The problem is that you can only read and write the object types mentioned in the documentation for Parcel, so it may be difficult to save absolutely everything.