public class Category implements Parcelable {
private int mCategoryId;
private List<Video> mCategoryVideos;
public int getCategoryId() {
return mCategoryId;
}
public void setCategoryId(int mCategoryId) {
this.mCategoryId = mCategoryId;
}
public List<Video> getCategoryVideos() {
return mCategoryVideos;
}
public void setCategoryVideos(List<Video> videoList) {
mCategoryVideos = videoList;
}
@Override
public void writeToParcel(Parcel parcel, int i) {
parcel.writeInt(mCategoryId);
parcel.writeTypedList(mCategoryVideos);
}
public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
public Category createFromParcel(Parcel parcel) {
final Category category = new Category();
category.setCategoryId(parcel.readInt());
category.setCategoryVideos(parcel.readTypedList()); */// **WHAT SHOULD I WRITE HERE***
return category;
}
public Category[] newArray(int size) {
return new Category[size];
}
};
}
임 내가 parcelable에서 구현 모델을 사용하고 내 코드 ... 사람이 내가 어떤 도움이 게시물을 찾을 수 없습니다 category.setCategoryVideos(parcel.readTypedList())
이 줄을 쓰기 무슨 소리 그들을 말할 수 없습니다.소포에 목록 <>을 작성하는 방법을
편집 : category.setCategoryVideos(parcel.readTypedList(mCategoryVideos,Video.CREATOR));
여기 mCategoryVideos 오류를 해결할 수 없습니다.
이 답변으로 올바른 표시되어야한다, 한 가지의 상점은 목록 Parcelable뿐만 아니라 개체를 포함해야한다는 것입니다. –
아주 작은 교정 :'parcel.readList (myList, ElementType.class.getClassLoader()); ' – WindRider
NullPointerException –