I'm facing a problem when passing a list of parcelable objects to the intent
of one new activity
.
Here's what I do:
Intent intent = new Intent(context, CurriculumCorsesActivity.class);
intent.setExtrasClassLoader(CurriculumCourseCard.class.getClassLoader());
intent.putParcelableArrayListExtra("courses", card.getCourses());
context.startActivity(intent);
And when I call the startActivity I get the following error:
E/Parcel﹕ Class not found when unmarshalling: pt.tecnico.fenixmobile.person.CurriculumCourseCard, e: java.lang.ClassNotFoundException: pt.tecnico.fenixmobile.person.CurriculumCourseCard
CurriculumCourseCard implements the Parcelable interface. Here's is the implementation:
public class CurriculumCourseCard implements Serializable, Parcelable{
private static final long serialVersionUID = 765578940083L;
private String courseName;
private String finalGrade;
private String ects;
public CurriculumCourseCard(Parcel in) {
this.courseName = in.readString();
this.finalGrade = in.readString();
this.ects = in.readString();
}
public String getCourseName() {
return courseName;
}
public String getFinalGrade() {
return finalGrade;
}
public String getEcts() {
return ects;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel parcel, int i) {
parcel.writeString(this.courseName);
parcel.writeString(this.finalGrade);
parcel.writeString(this.ects);
}
public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
public CurriculumCourseCard createFromParcel(Parcel in) {
return new CurriculumCourseCard(in);
}
public CurriculumCourseCard[] newArray(int size) {
return new CurriculumCourseCard[size];
}
};}
And this is how I'm getting the list in the new activity:
Intent intent = getIntent();
intent.setExtrasClassLoader(CurriculumCourseCard.class.getClassLoader());
ArrayList<CurriculumCourseCard> courses = intent.getParcelableArrayListExtra("courses");
In the new activity
I see as much items as there are in the list, but no content at all. And the only error is the one described before.
Hope you can help me.