I must deliver an Object value to other Activity, so I found the way to using Parcelable Object. but this is the problem
the outer ParcelableOjbect (I'll call this "1") has inner ParcelableOjbect variable(I'll call this "2"). so what I have to do is add innerParcelableObject into a outerParcelableObject.
the "2" which is I'll add is already setted up to Parcelable class
but the error occured line says this
writeParcelable(Parcelable, int) in Parcel cannot be applied
to (State)
This is the (1)
ublic class Progress implements Parcelable {
String time;
String location;
State status; // <<<----- this is (2)
String description;
public Progress(){}
public Progress(String time, String location, State status, String description) {
this.time = time;
this.location = location;
this.status = status;
this.description = description;
}
protected Progress(Parcel in){
in.writeString(time);
in.writeString(location);
in.writeParcelable(status); // <<-- the error occured here
in.writeString(description);
}
public static final Creator<Progress> CREATOR = new Creator<Progress>() {
@Override
public Progress createFromParcel(Parcel in) {
return new Progress(in);
}
@Override
public Progress[] newArray(int size) {
return new Progress[size];
}
};
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
}
// ... getters and setters
}
This is the (2)
public class State implements Parcelable {
String id;
String text;
public State(String id, String text) {
this.id = id;
this.text = text;
}
protected State(Parcel in) {
in.writeString(id);
in.writeString(text);
}
public static final Creator<State> CREATOR = new Creator<State>() {
@Override
public State createFromParcel(Parcel in) {
return new State(in);
}
@Override
public State[] newArray(int size) {
return new State[size];
}
};
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
}
// ... getters and setters
}
Is anything missing on this?