0
I need to make the Parcelable of this class, but it’s giving the error:
class not found when unmarshalling
Could you help me?
My class:
public class Internship implements Parcelable {
private Enterprise enterprise;
private int id;
private String publicationTime;
private String startDate;
private String end_date;
private String requirements;
private String benefits;
private int semester;
private String title;
private String observation;
private ArrayList<Course> courses = new ArrayList<Course>();
public Internship(){
}
public Internship(Parcel in){
this.enterprise = in.readParcelable(Enterprise.class.getClassLoader());
this.id = in.readInt();
this.publicationTime = in.readString();
this.startDate = in.readString();
this.end_date = in.readString();
this.requirements = in.readString();
this.benefits = in.readString();
this.semester = in.readInt();
this.title = in.readString();
this.observation = in.readString();
in.readList(courses, Course.class.getClassLoader());
}
public ArrayList<Course> getCourses() {
return courses;
}
public void addCourseToCourses(Course course) {
this.courses.add(course);
}
public Enterprise getEnterprise() {
return enterprise;
}
public void setEnterprise(Enterprise enterprise) {
this.enterprise = enterprise;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getPublicationTime() {
return publicationTime;
}
public void setPublicationTime(String publication_time) {
this.publicationTime = publication_time;
}
public String getStartDate() {
return startDate;
}
public void setStartDate(String start_date) {
this.startDate = start_date;
}
public String getEnd_date() {
return end_date;
}
public void setEnd_date(String end_date) {
this.end_date = end_date;
}
public String getRequirements() {
return requirements;
}
public void setRequirements(String requirements) {
this.requirements = requirements;
}
public String getBenefits() {
return benefits;
}
public void setBenefits(String benefits) {
this.benefits = benefits;
}
public int getSemester() {
return semester;
}
public void setSemester(int semester) {
this.semester = semester;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getObservation() {
return observation;
}
public void setObservation(String observation) {
this.observation = observation;
}
public static final Parcelable.Creator<Internship> CREATOR = new Parcelable.Creator<Internship>() {
public Internship createFromParcel(Parcel in){
return new Internship(in);
}
public Internship[] newArray(int size){
return new Internship[size];
}
};
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(id);
dest.writeString(publicationTime);
dest.writeString(title);
dest.writeString(startDate);
dest.writeString(end_date);
dest.writeString(requirements);
dest.writeString(benefits);
dest.writeInt(semester);
dest.writeString(observation);
dest.writeList(courses);
}
}
Perfect answer expensive, I managed to implement. Thank you very much!
– Vinícius Venancio dos Santos
That’s what we’re here for, @Vinicius
– Wellington Avelino