I am trying to pass a custom ArrayList of objects between activites. I keep getting wrong argument errors. Read around on exisitng questions but none of them could resolve the issue.
Could you please point me in the right direction?
CODE BREAKDOWN:
public class object1 implements parcelable{
public void writeToParcel(Parcel dest, int flags) {
//things that need to be written
}
public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
public MoodEvent createFromParcel(Parcel in) {
return new MoodEvent(in);
}
public MoodEvent[] newArray(int size) {
return new MoodEvent[size];
}
};
public class list1{ //** "implements Parceblable" gives error**
private ArrayList<object1> ArrayList1, ArrayList2; //** Filters used on **ArrayList2
public void writeToParcel(Parcel out) {
out.writeTypedList(ArrayList1);
}
public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
public MoodEvent createFromParcel(Parcel in) {
return new MoodEvent(in);
}
public MoodEvent[] newArray(int size) {
return new MoodEvent[size];
}
};
}
public class someActivity {
.
.
.
mapIntent = new Intent(oldActivity.this, NewActivity.class);
Bundle bundle = new Bundle();
bundle.putParcelableArrayList(moodEventList); //**wrong argument types on both lines**
mapIntent.putParcelableArrayListExtra("mylist",moodEventList);
.
.
.
}